pub enum Time {
UtcTime(UtcTime),
GeneralTime(GeneralizedTime),
}Expand description
X.501 Time as defined in RFC 5280 Section 4.1.2.5.
Schema definition from RFC 5280 Appendix A:
Time ::= CHOICE {
utcTime UTCTime,
generalTime GeneralizedTime
}Variants§
UtcTime(UtcTime)
Legacy UTC time (has 2-digit year, valid from 1970 to 2049).
Note: RFC 5280 specifies 1950-2049, however due to common operations working on
UNIX_EPOCH this implementation’s lower bound is 1970.
GeneralTime(GeneralizedTime)
Modern GeneralizedTime encoding with 4-digit year.
Implementations§
Source§impl Time
impl Time
Sourcepub fn to_unix_duration(self) -> Duration
pub fn to_unix_duration(self) -> Duration
Get duration since UNIX_EPOCH.
Sourcepub fn to_date_time(&self) -> DateTime
pub fn to_date_time(&self) -> DateTime
Get Time as DateTime
Sourcepub fn to_system_time(&self) -> SystemTime
pub fn to_system_time(&self) -> SystemTime
Convert to SystemTime.
Trait Implementations§
impl Copy for Time
Source§impl<'__der_lifetime> Decode<'__der_lifetime> for Time
impl<'__der_lifetime> Decode<'__der_lifetime> for Time
Source§impl<'__der_lifetime> DecodeValue<'__der_lifetime> for Time
impl<'__der_lifetime> DecodeValue<'__der_lifetime> for Time
Source§impl<'__der_lifetime> EncodeValue for Time
impl<'__der_lifetime> EncodeValue for Time
impl Eq for Time
Source§impl From<GeneralizedTime> for Time
impl From<GeneralizedTime> for Time
Source§fn from(time: GeneralizedTime) -> Time
fn from(time: GeneralizedTime) -> Time
Converts to this type from the input type.
Source§impl<'__der_lifetime> IsConstructed for Time
impl<'__der_lifetime> IsConstructed for Time
Source§const CONSTRUCTED: bool = true
const CONSTRUCTED: bool = true
ASN.1 constructed bit
impl StructuralPartialEq for Time
Source§impl TryFrom<SystemTime> for Time
Available on crate feature std only.
impl TryFrom<SystemTime> for Time
Available on crate feature
std only.Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnsafeUnpin for Time
impl UnwindSafe for Time
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,
impl<T> DecodeOwned for Twhere
T: for<'a> Decode<'a>,
Source§impl<T> Encode for T
impl<T> Encode for T
Source§fn encoded_len(&self) -> Result<Length, Error>
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this TLV object in bytes when encoded as ASN.1 DER. Read more
Source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Encode this TLV object to the provided byte slice, returning a sub-slice
containing the encoded message. Read more