@@ -694,6 +694,23 @@ impl Metadata {
694
694
///
695
695
/// This field may not be available on all platforms, and will return an
696
696
/// `Err` on platforms where it is not available.
697
+ ///
698
+ /// # Examples
699
+ ///
700
+ /// ```
701
+ /// # fn foo() -> std::io::Result<()> {
702
+ /// use std::fs;
703
+ ///
704
+ /// let metadata = try!(fs::metadata("foo.txt"));
705
+ ///
706
+ /// if let Ok(time) = metadata.modified() {
707
+ /// println!("{:?}", time);
708
+ /// } else {
709
+ /// println!("Not supported on this platform");
710
+ /// }
711
+ /// # Ok(())
712
+ /// # }
713
+ /// ```
697
714
#[ stable( feature = "fs_time" , since = "1.10.0" ) ]
698
715
pub fn modified ( & self ) -> io:: Result < SystemTime > {
699
716
self . 0 . modified ( ) . map ( FromInner :: from_inner)
@@ -712,6 +729,23 @@ impl Metadata {
712
729
///
713
730
/// This field may not be available on all platforms, and will return an
714
731
/// `Err` on platforms where it is not available.
732
+ ///
733
+ /// # Examples
734
+ ///
735
+ /// ```
736
+ /// # fn foo() -> std::io::Result<()> {
737
+ /// use std::fs;
738
+ ///
739
+ /// let metadata = try!(fs::metadata("foo.txt"));
740
+ ///
741
+ /// if let Ok(time) = metadata.accessed() {
742
+ /// println!("{:?}", time);
743
+ /// } else {
744
+ /// println!("Not supported on this platform");
745
+ /// }
746
+ /// # Ok(())
747
+ /// # }
748
+ /// ```
715
749
#[ stable( feature = "fs_time" , since = "1.10.0" ) ]
716
750
pub fn accessed ( & self ) -> io:: Result < SystemTime > {
717
751
self . 0 . accessed ( ) . map ( FromInner :: from_inner)
@@ -726,6 +760,23 @@ impl Metadata {
726
760
///
727
761
/// This field may not be available on all platforms, and will return an
728
762
/// `Err` on platforms where it is not available.
763
+ ///
764
+ /// # Examples
765
+ ///
766
+ /// ```
767
+ /// # fn foo() -> std::io::Result<()> {
768
+ /// use std::fs;
769
+ ///
770
+ /// let metadata = try!(fs::metadata("foo.txt"));
771
+ ///
772
+ /// if let Ok(time) = metadata.created() {
773
+ /// println!("{:?}", time);
774
+ /// } else {
775
+ /// println!("Not supported on this platform");
776
+ /// }
777
+ /// # Ok(())
778
+ /// # }
779
+ /// ```
729
780
#[ stable( feature = "fs_time" , since = "1.10.0" ) ]
730
781
pub fn created ( & self ) -> io:: Result < SystemTime > {
731
782
self . 0 . created ( ) . map ( FromInner :: from_inner)
0 commit comments