pub struct DateTime { /* private fields */ }Expand description
Date-and-time type shared by multiple ASN.1 types
(e.g. GeneralizedTime, UTCTime).
Following conventions from RFC 5280, this type is always Z-normalized
(i.e. represents a UTC time). However, it isn’t named “UTC time” in order
to prevent confusion with ASN.1 UTCTime.
Implementations§
Source§impl DateTime
 
impl DateTime
Sourcepub const INFINITY: DateTime
 
pub const INFINITY: DateTime
This is the maximum date represented by the DateTime
This corresponds to: 9999-12-31T23:59:59Z
Sourcepub fn new(
    year: u16,
    month: u8,
    day: u8,
    hour: u8,
    minutes: u8,
    seconds: u8,
) -> Result<Self>
 
pub fn new( year: u16, month: u8, day: u8, hour: u8, minutes: u8, seconds: u8, ) -> Result<Self>
Create a new DateTime from the given UTC time components.
Sourcepub fn from_unix_duration(unix_duration: Duration) -> Result<Self>
 
pub fn from_unix_duration(unix_duration: Duration) -> Result<Self>
Sourcepub fn unix_duration(&self) -> Duration
 
pub fn unix_duration(&self) -> Duration
Compute Duration since UNIX_EPOCH from the given calendar date.
Sourcepub fn from_system_time(time: SystemTime) -> Result<Self>
 Available on crate feature std only.
pub fn from_system_time(time: SystemTime) -> Result<Self>
std only.Instantiate from SystemTime.
Sourcepub fn to_system_time(&self) -> SystemTime
 Available on crate feature std only.
pub fn to_system_time(&self) -> SystemTime
std only.Convert to SystemTime.
Trait Implementations§
Source§impl<'a> Arbitrary<'a> for DateTime
Available on crate feature arbitrary only. 
impl<'a> Arbitrary<'a> for DateTime
Available on crate feature 
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
 
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of 
Self from the given unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
 
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an 
Unstructured this type
needs to construct itself. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
 
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of 
Self from the entirety of the given
unstructured data. Read moreSource§fn try_size_hint(
    depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
 
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an 
Unstructured this type
needs to construct itself. Read moreSource§impl<'a> DecodeValue<'a> for DateTime
 
impl<'a> DecodeValue<'a> for DateTime
Source§impl EncodeValue for DateTime
 
impl EncodeValue for DateTime
Source§impl From<&DateTime> for GeneralizedTime
 
impl From<&DateTime> for GeneralizedTime
Source§impl From<&DateTime> for SystemTime
Available on crate feature std only. 
impl From<&DateTime> for SystemTime
Available on crate feature 
std only.Source§fn from(time: &DateTime) -> SystemTime
 
fn from(time: &DateTime) -> SystemTime
Converts to this type from the input type.
Source§impl From<&GeneralizedTime> for DateTime
 
impl From<&GeneralizedTime> for DateTime
Source§fn from(utc_time: &GeneralizedTime) -> DateTime
 
fn from(utc_time: &GeneralizedTime) -> DateTime
Converts to this type from the input type.
Source§impl From<DateTime> for GeneralizedTime
 
impl From<DateTime> for GeneralizedTime
Source§impl From<DateTime> for SystemTime
Available on crate feature std only. 
impl From<DateTime> for SystemTime
Available on crate feature 
std only.Source§fn from(time: DateTime) -> SystemTime
 
fn from(time: DateTime) -> SystemTime
Converts to this type from the input type.
Source§impl From<GeneralizedTime> for DateTime
 
impl From<GeneralizedTime> for DateTime
Source§fn from(utc_time: GeneralizedTime) -> DateTime
 
fn from(utc_time: GeneralizedTime) -> DateTime
Converts to this type from the input type.
Source§impl Ord for DateTime
 
impl Ord for DateTime
Source§impl PartialOrd for DateTime
 
impl PartialOrd for DateTime
Source§impl TryFrom<&SystemTime> for DateTime
Available on crate feature std only. 
impl TryFrom<&SystemTime> for DateTime
Available on crate feature 
std only.Source§impl TryFrom<DateTime> for PrimitiveDateTime
Available on crate feature time only. 
impl TryFrom<DateTime> for PrimitiveDateTime
Available on crate feature 
time only.Source§impl TryFrom<PrimitiveDateTime> for DateTime
Available on crate feature time only. 
impl TryFrom<PrimitiveDateTime> for DateTime
Available on crate feature 
time only.Source§impl TryFrom<SystemTime> for DateTime
Available on crate feature std only. 
impl TryFrom<SystemTime> for DateTime
Available on crate feature 
std only.impl Copy for DateTime
impl Eq for DateTime
impl StructuralPartialEq for DateTime
Auto Trait Implementations§
impl Freeze for DateTime
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<'a, T> Decode<'a> for Twhere
    T: DecodeValue<'a> + FixedTag,
 
impl<'a, T> Decode<'a> for Twhere
    T: DecodeValue<'a> + FixedTag,
Source§impl<T> Encode for Twhere
    T: EncodeValue + Tagged,
 
impl<T> Encode for Twhere
    T: EncodeValue + Tagged,
Source§fn encoded_len(&self) -> Result<Length, Error>
 
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this value in bytes when encoded as ASN.1 DER.
Source§fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
 
fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
Encode this value as ASN.1 DER using the provided Writer.
Source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
 
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
Encode this value to the provided byte slice, returning a sub-slice
containing the encoded message.