Struct der::asn1::GeneralizedTime  
source · pub struct GeneralizedTime(/* private fields */);Expand description
ASN.1 GeneralizedTime type.
This type implements the validity requirements specified in RFC 5280 Section 4.1.2.5.2, namely:
For the purposes of this profile, GeneralizedTime values MUST be expressed in Greenwich Mean Time (Zulu) and MUST include seconds (i.e., times are
YYYYMMDDHHMMSSZ), even where the number of seconds is zero. GeneralizedTime values MUST NOT include fractional seconds.
Implementations§
source§impl GeneralizedTime
 
impl GeneralizedTime
sourcepub fn from_date_time(datetime: DateTime) -> Self
 
pub fn from_date_time(datetime: DateTime) -> Self
Create a GeneralizedTime from a DateTime.
sourcepub fn to_date_time(&self) -> DateTime
 
pub fn to_date_time(&self) -> DateTime
Convert this GeneralizedTime into a DateTime.
sourcepub fn from_unix_duration(unix_duration: Duration) -> Result<Self>
 
pub fn from_unix_duration(unix_duration: Duration) -> Result<Self>
Create a new GeneralizedTime given a [Duration] since UNIX_EPOCH
(a.k.a. “Unix time”)
sourcepub fn to_unix_duration(&self) -> Duration
 
pub fn to_unix_duration(&self) -> Duration
Get the duration of this timestamp since UNIX_EPOCH.
Trait Implementations§
source§impl Clone for GeneralizedTime
 
impl Clone for GeneralizedTime
source§fn clone(&self) -> GeneralizedTime
 
fn clone(&self) -> GeneralizedTime
Returns a copy of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moresource§impl Debug for GeneralizedTime
 
impl Debug for GeneralizedTime
source§impl<'a> DecodeValue<'a> for GeneralizedTime
 
impl<'a> DecodeValue<'a> for GeneralizedTime
source§impl EncodeValue for GeneralizedTime
 
impl EncodeValue for GeneralizedTime
source§impl From<&DateTime> for GeneralizedTime
 
impl From<&DateTime> for GeneralizedTime
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<&GeneralizedTime> for GeneralizedTime
 
impl From<&GeneralizedTime> for GeneralizedTime
source§fn from(value: &GeneralizedTime) -> GeneralizedTime
 
fn from(value: &GeneralizedTime) -> GeneralizedTime
Converts to this type from the input type.
source§impl From<DateTime> for GeneralizedTime
 
impl From<DateTime> for GeneralizedTime
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 GeneralizedTime
 
impl Ord for GeneralizedTime
source§impl PartialEq for GeneralizedTime
 
impl PartialEq for GeneralizedTime
source§impl PartialOrd for GeneralizedTime
 
impl PartialOrd for GeneralizedTime
source§fn partial_cmp(&self, other: &GeneralizedTime) -> Option<Ordering>
 
fn partial_cmp(&self, other: &GeneralizedTime) -> Option<Ordering>
source§impl TryFrom<AnyRef<'_>> for GeneralizedTime
 
impl TryFrom<AnyRef<'_>> for GeneralizedTime
impl Copy for GeneralizedTime
impl Eq for GeneralizedTime
impl StructuralPartialEq for GeneralizedTime
Auto Trait Implementations§
impl Freeze for GeneralizedTime
impl RefUnwindSafe for GeneralizedTime
impl Send for GeneralizedTime
impl Sync for GeneralizedTime
impl Unpin for GeneralizedTime
impl UnwindSafe for GeneralizedTime
Blanket Implementations§
§impl<T> Any for Twhere
    T: 'static + ?Sized,
 
impl<T> Any for Twhere
    T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
    T: ?Sized,
 
impl<T> Borrow<T> for Twhere
    T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<'a, T> Choice<'a> for T
 
impl<'a, T> Choice<'a> for T
source§fn can_decode(tag: Tag) -> bool
 
fn can_decode(tag: Tag) -> bool
Is the provided 
Tag decodable as a variant of this CHOICE?§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
 
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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 dyn Writer) -> Result<(), Error>
 
fn encode(&self, writer: &mut dyn 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.
source§fn encode_to_vec(&self, buf: &mut Vec<u8>) -> Result<Length>
 
fn encode_to_vec(&self, buf: &mut Vec<u8>) -> Result<Length>
Encode this message as ASN.1 DER, appending it to the provided
byte vector.