Struct der::asn1::GeneralizedTime
source · [−]pub struct GeneralizedTime(_);
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
sourceimpl GeneralizedTime
impl GeneralizedTime
sourcepub const LENGTH: Length = Length::new(15)
pub const LENGTH: Length = Length::new(15)
Length of an RFC 5280-flavored ASN.1 DER-encoded GeneralizedTime
.
sourcepub fn new(unix_duration: Duration) -> Result<Self>
pub fn new(unix_duration: Duration) -> Result<Self>
Create a new GeneralizedTime
given a Duration
since UNIX_EPOCH
(a.k.a. “Unix time”)
sourcepub fn unix_duration(&self) -> Duration
pub fn unix_duration(&self) -> Duration
Get the duration of this timestamp since UNIX_EPOCH
.
sourcepub fn from_system_time(time: SystemTime) -> Result<Self>
pub fn from_system_time(time: SystemTime) -> Result<Self>
Instantiate from SystemTime
.
sourcepub fn to_system_time(&self) -> SystemTime
pub fn to_system_time(&self) -> SystemTime
Convert to SystemTime
.
Trait Implementations
sourceimpl Clone for GeneralizedTime
impl Clone for GeneralizedTime
sourcefn clone(&self) -> GeneralizedTime
fn clone(&self) -> GeneralizedTime
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for GeneralizedTime
impl Debug for GeneralizedTime
sourceimpl Encodable for GeneralizedTime
impl Encodable for GeneralizedTime
sourcefn encoded_len(&self) -> Result<Length>
fn encoded_len(&self) -> Result<Length>
Compute the length of this value in bytes when encoded as ASN.1 DER.
sourcefn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>
fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>
Encode this value as ASN.1 DER using the provided Encoder
.
sourcefn 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. Read more
sourceimpl From<&'_ GeneralizedTime> for GeneralizedTime
impl From<&'_ GeneralizedTime> for GeneralizedTime
sourcefn from(value: &GeneralizedTime) -> GeneralizedTime
fn from(value: &GeneralizedTime) -> GeneralizedTime
Converts to this type from the input type.
sourceimpl From<GeneralizedTime> for SystemTime
impl From<GeneralizedTime> for SystemTime
sourcefn from(utc_time: GeneralizedTime) -> SystemTime
fn from(utc_time: GeneralizedTime) -> SystemTime
Converts to this type from the input type.
sourceimpl Ord for GeneralizedTime
impl Ord for GeneralizedTime
sourceimpl PartialEq<GeneralizedTime> for GeneralizedTime
impl PartialEq<GeneralizedTime> for GeneralizedTime
sourcefn eq(&self, other: &GeneralizedTime) -> bool
fn eq(&self, other: &GeneralizedTime) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &GeneralizedTime) -> bool
fn ne(&self, other: &GeneralizedTime) -> bool
This method tests for !=
.
sourceimpl PartialOrd<GeneralizedTime> for GeneralizedTime
impl PartialOrd<GeneralizedTime> for GeneralizedTime
sourcefn partial_cmp(&self, other: &GeneralizedTime) -> Option<Ordering>
fn partial_cmp(&self, other: &GeneralizedTime) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl TryFrom<Any<'_>> for GeneralizedTime
impl TryFrom<Any<'_>> for GeneralizedTime
impl Copy for GeneralizedTime
impl Eq for GeneralizedTime
impl StructuralEq for GeneralizedTime
impl StructuralPartialEq for GeneralizedTime
Auto Trait Implementations
impl RefUnwindSafe for GeneralizedTime
impl Send for GeneralizedTime
impl Sync for GeneralizedTime
impl Unpin for GeneralizedTime
impl UnwindSafe for GeneralizedTime
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more