pub struct HttpDate(/* private fields */);Expand description
A formatted Date value: an IMF-fixdate such as
Sun, 06 Nov 1994 08:49:37 GMT (always 29 bytes).
§Examples
use http_net::HttpDate;
let d = HttpDate::from_unix_seconds(784_111_777);
assert_eq!(d.as_str(), "Sun, 06 Nov 1994 08:49:37 GMT");
assert_eq!(d.as_bytes().len(), 29);Implementations§
Source§impl HttpDate
impl HttpDate
Sourcepub const fn from_unix_seconds(secs: u64) -> Self
pub const fn from_unix_seconds(secs: u64) -> Self
Formats secs seconds after the Unix epoch. Times after the year
9999 are shown as its last second, the latest the format can hold.
§Examples
use http_net::HttpDate;
assert_eq!(HttpDate::from_unix_seconds(0).as_str(), "Thu, 01 Jan 1970 00:00:00 GMT");
assert_eq!(HttpDate::from_unix_seconds(u64::MAX).as_str(), "Fri, 31 Dec 9999 23:59:59 GMT");Trait Implementations§
impl Copy for HttpDate
impl Eq for HttpDate
impl StructuralPartialEq for HttpDate
Auto Trait Implementations§
impl Freeze for HttpDate
impl RefUnwindSafe for HttpDate
impl Send for HttpDate
impl Sync for HttpDate
impl Unpin for HttpDate
impl UnsafeUnpin for HttpDate
impl UnwindSafe for HttpDate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more