pub struct Asn1Time(/* private fields */);
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§
Source§impl 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
This corresponds to ASN1_TIME_set
.
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.
Requires BoringSSL or OpenSSL 1.1.1 or newer.
This corresponds to ASN1_TIME_set_string_X509
.
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
.
Trait Implementations§
Source§impl AsRef<Asn1TimeRef> for Asn1Time
impl AsRef<Asn1TimeRef> for Asn1Time
Source§fn as_ref(&self) -> &Asn1TimeRef
fn as_ref(&self) -> &Asn1TimeRef
Source§impl Borrow<Asn1TimeRef> for Asn1Time
impl Borrow<Asn1TimeRef> for Asn1Time
Source§fn borrow(&self) -> &Asn1TimeRef
fn borrow(&self) -> &Asn1TimeRef
Source§impl Deref for Asn1Time
impl Deref for Asn1Time
Source§type Target = Asn1TimeRef
type Target = Asn1TimeRef
Source§fn deref(&self) -> &Asn1TimeRef
fn deref(&self) -> &Asn1TimeRef
Source§impl DerefMut for Asn1Time
impl DerefMut for Asn1Time
Source§fn deref_mut(&mut self) -> &mut Asn1TimeRef
fn deref_mut(&mut self) -> &mut Asn1TimeRef
Source§impl ForeignType for Asn1Time
impl ForeignType for Asn1Time
Source§impl<'a> PartialEq<&'a Asn1TimeRef> for Asn1Time
impl<'a> PartialEq<&'a Asn1TimeRef> for Asn1Time
Source§impl PartialEq<Asn1Time> for &Asn1TimeRef
impl PartialEq<Asn1Time> for &Asn1TimeRef
Source§impl PartialEq<Asn1Time> for Asn1TimeRef
impl PartialEq<Asn1Time> for Asn1TimeRef
Source§impl PartialEq<Asn1TimeRef> for Asn1Time
impl PartialEq<Asn1TimeRef> for Asn1Time
Source§impl<'a> PartialOrd<&'a Asn1TimeRef> for Asn1Time
impl<'a> PartialOrd<&'a Asn1TimeRef> for Asn1Time
Source§impl PartialOrd<Asn1Time> for &Asn1TimeRef
impl PartialOrd<Asn1Time> for &Asn1TimeRef
Source§impl PartialOrd<Asn1Time> for Asn1TimeRef
impl PartialOrd<Asn1Time> for Asn1TimeRef
Source§impl PartialOrd<Asn1TimeRef> for Asn1Time
impl PartialOrd<Asn1TimeRef> for Asn1Time
Source§impl PartialOrd for Asn1Time
impl PartialOrd for Asn1Time
impl Send for Asn1Time
impl Sync for Asn1Time
Auto Trait Implementations§
impl Freeze for Asn1Time
impl RefUnwindSafe for Asn1Time
impl Unpin for Asn1Time
impl UnwindSafe for Asn1Time
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
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes