pub struct Asn1Time(_);
Expand description
Time storage and comparison
Asn1Time should be used to store and share time information using certificates. If Asn1Time is set using a string, it must be in either YYMMDDHHMMSSZ, YYYYMMDDHHMMSSZ, or another ASN.1 format.
ASN_TIME_set documentation at OpenSSL explains the ASN.1 implementation used by OpenSSL.
Implementations
sourceimpl Asn1Time
impl Asn1Time
sourcepub fn days_from_now(days: u32) -> Result<Asn1Time, ErrorStack>
pub fn days_from_now(days: u32) -> Result<Asn1Time, ErrorStack>
Creates a new time on specified interval in days from now
sourcepub fn from_unix(time: time_t) -> Result<Asn1Time, ErrorStack>
pub fn from_unix(time: time_t) -> Result<Asn1Time, ErrorStack>
Creates a new time from the specified time_t
value
sourcepub fn from_str(s: &str) -> Result<Asn1Time, ErrorStack>
pub fn from_str(s: &str) -> Result<Asn1Time, ErrorStack>
Creates a new time corresponding to the specified ASN1 time string.
This corresponds to ASN1_TIME_set_string
.
sourcepub fn from_str_x509(s: &str) -> Result<Asn1Time, ErrorStack>
pub fn from_str_x509(s: &str) -> Result<Asn1Time, ErrorStack>
Creates a new time corresponding to the specified X509 time string.
This corresponds to ASN1_TIME_set_string_X509
.
Requires OpenSSL 1.1.1 or newer.
Methods from Deref<Target = Asn1TimeRef>
sourcepub fn diff(&self, compare: &Self) -> Result<TimeDiff, ErrorStack>
pub fn diff(&self, compare: &Self) -> Result<TimeDiff, ErrorStack>
Find difference between two times
This corresponds to ASN1_TIME_diff
.
sourcepub fn compare(&self, other: &Self) -> Result<Ordering, ErrorStack>
pub fn compare(&self, other: &Self) -> Result<Ordering, ErrorStack>
Compare two times
This corresponds to ASN1_TIME_compare
but is implemented using diff
so that it is
also supported on older versions of OpenSSL.
Trait Implementations
sourceimpl AsRef<Asn1TimeRef> for Asn1Time
impl AsRef<Asn1TimeRef> for Asn1Time
sourcefn as_ref(&self) -> &Asn1TimeRef
fn as_ref(&self) -> &Asn1TimeRef
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Borrow<Asn1TimeRef> for Asn1Time
impl Borrow<Asn1TimeRef> for Asn1Time
sourcefn borrow(&self) -> &Asn1TimeRef
fn borrow(&self) -> &Asn1TimeRef
Immutably borrows from an owned value. Read more
sourceimpl Deref for Asn1Time
impl Deref for Asn1Time
type Target = Asn1TimeRef
type Target = Asn1TimeRef
The resulting type after dereferencing.
sourcefn deref(&self) -> &Asn1TimeRef
fn deref(&self) -> &Asn1TimeRef
Dereferences the value.
sourceimpl DerefMut for Asn1Time
impl DerefMut for Asn1Time
sourcefn deref_mut(&mut self) -> &mut Asn1TimeRef
fn deref_mut(&mut self) -> &mut Asn1TimeRef
Mutably dereferences the value.
sourceimpl ForeignType for Asn1Time
impl ForeignType for Asn1Time
sourceimpl<'a> PartialEq<&'a Asn1TimeRef> for Asn1Time
impl<'a> PartialEq<&'a Asn1TimeRef> for Asn1Time
sourceimpl PartialEq<Asn1Time> for Asn1TimeRef
impl PartialEq<Asn1Time> for Asn1TimeRef
sourceimpl<'a> PartialEq<Asn1Time> for &'a Asn1TimeRef
impl<'a> PartialEq<Asn1Time> for &'a Asn1TimeRef
sourceimpl PartialEq<Asn1TimeRef> for Asn1Time
impl PartialEq<Asn1TimeRef> for Asn1Time
sourceimpl<'a> PartialOrd<&'a Asn1TimeRef> for Asn1Time
impl<'a> PartialOrd<&'a Asn1TimeRef> for Asn1Time
sourcefn partial_cmp(&self, other: &&'a Asn1TimeRef) -> Option<Ordering>
fn partial_cmp(&self, other: &&'a Asn1TimeRef) -> 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 PartialOrd<Asn1Time> for Asn1TimeRef
impl PartialOrd<Asn1Time> for Asn1TimeRef
sourcefn partial_cmp(&self, other: &Asn1Time) -> Option<Ordering>
fn partial_cmp(&self, other: &Asn1Time) -> 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<'a> PartialOrd<Asn1Time> for &'a Asn1TimeRef
impl<'a> PartialOrd<Asn1Time> for &'a Asn1TimeRef
sourcefn partial_cmp(&self, other: &Asn1Time) -> Option<Ordering>
fn partial_cmp(&self, other: &Asn1Time) -> 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 PartialOrd<Asn1Time> for Asn1Time
impl PartialOrd<Asn1Time> for Asn1Time
sourcefn partial_cmp(&self, other: &Asn1Time) -> Option<Ordering>
fn partial_cmp(&self, other: &Asn1Time) -> 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 PartialOrd<Asn1TimeRef> for Asn1Time
impl PartialOrd<Asn1TimeRef> for Asn1Time
sourcefn partial_cmp(&self, other: &Asn1TimeRef) -> Option<Ordering>
fn partial_cmp(&self, other: &Asn1TimeRef) -> 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
impl Send for Asn1Time
impl Sync for Asn1Time
Auto Trait Implementations
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