@@ -10,10 +10,37 @@ use std::{fs, io, path::Path, time::SystemTime};
1010/// [`Metadata`] time-related extension methods.
1111pub trait MetadataTimeExt : private:: Sealed {
1212 /// Returns the created time.
13+ ///
14+ /// # Panics
15+ ///
16+ /// Panics if the stored duration is outside the platform's representable
17+ /// `SystemTime` range.
18+ #[ deprecated(
19+ since = "0.34.0" ,
20+ note = "panics for archive timestamps outside the platform's SystemTime range; use try_created_time or saturating_created_time"
21+ ) ]
1322 fn created_time ( & self ) -> Option < SystemTime > ;
1423 /// Returns the modified time.
24+ ///
25+ /// # Panics
26+ ///
27+ /// Panics if the stored duration is outside the platform's representable
28+ /// `SystemTime` range.
29+ #[ deprecated(
30+ since = "0.34.0" ,
31+ note = "panics for archive timestamps outside the platform's SystemTime range; use try_modified_time or saturating_modified_time"
32+ ) ]
1533 fn modified_time ( & self ) -> Option < SystemTime > ;
1634 /// Returns the accessed time.
35+ ///
36+ /// # Panics
37+ ///
38+ /// Panics if the stored duration is outside the platform's representable
39+ /// `SystemTime` range.
40+ #[ deprecated(
41+ since = "0.34.0" ,
42+ note = "panics for archive timestamps outside the platform's SystemTime range; use try_accessed_time or saturating_accessed_time"
43+ ) ]
1744 fn accessed_time ( & self ) -> Option < SystemTime > ;
1845 /// Returns the created time, or `Err` if the stored duration is outside
1946 /// the platform's representable [`SystemTime`] range.
@@ -61,6 +88,7 @@ impl MetadataTimeExt for Metadata {
6188 ///
6289 /// This is the same as [Metadata::created] + [SystemTime::UNIX_EPOCH].
6390 /// ```
91+ /// # #![allow(deprecated)]
6492 /// use pna::{Duration, Metadata, prelude::*};
6593 /// use std::time::UNIX_EPOCH;
6694 ///
@@ -71,6 +99,7 @@ impl MetadataTimeExt for Metadata {
7199 /// metadata.created_time(),
72100 /// );
73101 /// ```
102+ #[ allow( deprecated) ]
74103 #[ inline]
75104 fn created_time ( & self ) -> Option < SystemTime > {
76105 self . created ( ) . map ( |it| SystemTime :: UNIX_EPOCH + it)
@@ -80,6 +109,7 @@ impl MetadataTimeExt for Metadata {
80109 ///
81110 /// This is the same as [Metadata::modified] + [SystemTime::UNIX_EPOCH].
82111 /// ```
112+ /// # #![allow(deprecated)]
83113 /// use pna::{Duration, Metadata, prelude::*};
84114 /// use std::time::UNIX_EPOCH;
85115 ///
@@ -90,6 +120,7 @@ impl MetadataTimeExt for Metadata {
90120 /// metadata.modified_time(),
91121 /// );
92122 /// ```
123+ #[ allow( deprecated) ]
93124 #[ inline]
94125 fn modified_time ( & self ) -> Option < SystemTime > {
95126 self . modified ( ) . map ( |it| SystemTime :: UNIX_EPOCH + it)
@@ -99,6 +130,7 @@ impl MetadataTimeExt for Metadata {
99130 ///
100131 /// This is the same as [Metadata::accessed] + [SystemTime::UNIX_EPOCH].
101132 /// ```
133+ /// # #![allow(deprecated)]
102134 /// use pna::{Duration, Metadata, prelude::*};
103135 /// use std::time::UNIX_EPOCH;
104136 ///
@@ -109,6 +141,7 @@ impl MetadataTimeExt for Metadata {
109141 /// metadata.accessed_time(),
110142 /// );
111143 /// ```
144+ #[ allow( deprecated) ]
112145 #[ inline]
113146 fn accessed_time ( & self ) -> Option < SystemTime > {
114147 self . accessed ( ) . map ( |it| SystemTime :: UNIX_EPOCH + it)
@@ -148,6 +181,7 @@ impl MetadataTimeExt for Metadata {
148181 ///
149182 /// # Examples
150183 /// ```
184+ /// # #![allow(deprecated)]
151185 /// use pna::{Metadata, prelude::*};
152186 /// use std::time::{Duration, SystemTime, UNIX_EPOCH};
153187 ///
@@ -173,6 +207,7 @@ impl MetadataTimeExt for Metadata {
173207 ///
174208 /// # Examples
175209 /// ```
210+ /// # #![allow(deprecated)]
176211 /// use pna::{Metadata, prelude::*};
177212 /// use std::time::{Duration, SystemTime, UNIX_EPOCH};
178213 ///
@@ -198,6 +233,7 @@ impl MetadataTimeExt for Metadata {
198233 ///
199234 /// # Examples
200235 /// ```
236+ /// # #![allow(deprecated)]
201237 /// use pna::{Metadata, prelude::*};
202238 /// use std::time::{Duration, SystemTime, UNIX_EPOCH};
203239 ///
0 commit comments