pub struct HttpDate { /* private fields */ }Expand description
An HTTP date in one of the three formats defined in RFC 9110 § 5.6.7.
Values are created with HttpDate::imf_fixdate, HttpDate::rfc850,
and HttpDate::asctime, or parsed with decode. Construction
guarantees the components are always in range, so encode never fails.
Implementations§
Source§impl HttpDate
impl HttpDate
Sourcepub fn imf_fixdate(dt: DateTime) -> Self
pub fn imf_fixdate(dt: DateTime) -> Self
Constructs an IMF-fixdate, e.g. Sun, 06 Nov 1994 08:49:37 GMT.
Sourcepub fn rfc850(dt: DateTime) -> Result<Self, DecodeError>
pub fn rfc850(dt: DateTime) -> Result<Self, DecodeError>
Constructs an RFC 850 date, e.g. Sunday, 06-Nov-94 08:49:37 GMT.
The year must be in the range 0–99.
§Errors
Returns a DecodeError if the year is outside 0–99, which cannot be
represented in RFC 850’s two-digit-year format.
pub fn is_imf_fixdate(&self) -> bool
pub fn is_rfc850(&self) -> bool
pub fn is_asctime(&self) -> bool
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