Convert `Cookie::max_age` and `Cookie::expires` examples to `time` 0.2

This commit is contained in:
kevinpoitra 2020-01-08 02:46:36 -06:00
parent 85e341b0b0
commit 7a43c564e1
1 changed files with 2 additions and 2 deletions

View File

@ -478,7 +478,7 @@ impl<'c> Cookie<'c> {
/// assert_eq!(c.max_age(), None); /// assert_eq!(c.max_age(), None);
/// ///
/// let c = Cookie::parse("name=value; Max-Age=3600").unwrap(); /// let c = Cookie::parse("name=value; Max-Age=3600").unwrap();
/// assert_eq!(c.max_age().map(|age| age.num_hours()), Some(1)); /// assert_eq!(c.max_age().map(|age| age.whole_hours()), Some(1));
/// ``` /// ```
#[inline] #[inline]
pub fn max_age(&self) -> Option<Duration> { pub fn max_age(&self) -> Option<Duration> {
@ -543,7 +543,7 @@ impl<'c> Cookie<'c> {
/// let expire_time = "Wed, 21 Oct 2017 07:28:00 GMT"; /// let expire_time = "Wed, 21 Oct 2017 07:28:00 GMT";
/// let cookie_str = format!("name=value; Expires={}", expire_time); /// let cookie_str = format!("name=value; Expires={}", expire_time);
/// let c = Cookie::parse(cookie_str).unwrap(); /// let c = Cookie::parse(cookie_str).unwrap();
/// assert_eq!(c.expires().map(|t| t.tm_year), Some(117)); /// assert_eq!(c.expires().map(|t| t.year()), Some(2017));
/// ``` /// ```
#[inline] #[inline]
pub fn expires(&self) -> Option<OffsetDateTime> { pub fn expires(&self) -> Option<OffsetDateTime> {