File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -863,9 +863,31 @@ impl fmt::Debug for Thread {
863863// JoinHandle
864864////////////////////////////////////////////////////////////////////////////////
865865
866+ /// A specialized [`Result`] type for threads.
867+ ///
866868/// Indicates the manner in which a thread exited.
867869///
868870/// A thread that completes without panicking is considered to exit successfully.
871+ ///
872+ /// # Examples
873+ ///
874+ /// ```no_run
875+ /// use std::thread;
876+ /// use std::fs;
877+ ///
878+ /// fn copy_in_thread() -> thread::Result<()> {
879+ /// thread::spawn(move || { fs::copy("foo.txt", "bar.txt").unwrap(); }).join()
880+ /// }
881+ ///
882+ /// fn main() {
883+ /// match copy_in_thread() {
884+ /// Ok(_) => println!("this is fine"),
885+ /// Err(_) => println!("thread panicked"),
886+ /// }
887+ /// }
888+ /// ```
889+ ///
890+ /// [`Result`]: ../../std/result/enum.Result.html
869891#[ stable( feature = "rust1" , since = "1.0.0" ) ]
870892pub type Result < T > = :: result:: Result < T , Box < Any + Send + ' static > > ;
871893
You can’t perform that action at this time.
0 commit comments