Asn1Time

Struct Asn1Time 

Source
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

Source

pub fn days_from_now(days: u32) -> Result<Asn1Time, ErrorStack>

Creates a new time on specified interval in days from now

Source

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.

Source

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.

Source

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>§

Source

pub fn diff(&self, compare: &Self) -> Result<TimeDiff, ErrorStack>

Find difference between two times

This corresponds to ASN1_TIME_diff.

Source

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

Source§

fn as_ref(&self) -> &Asn1TimeRef

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<Asn1TimeRef> for Asn1Time

Source§

fn borrow(&self) -> &Asn1TimeRef

Immutably borrows from an owned value. Read more
Source§

impl Deref for Asn1Time

Source§

type Target = Asn1TimeRef

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Asn1TimeRef

Dereferences the value.
Source§

impl DerefMut for Asn1Time

Source§

fn deref_mut(&mut self) -> &mut Asn1TimeRef

Mutably dereferences the value.
Source§

impl Drop for Asn1Time

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl ForeignType for Asn1Time

Source§

type CType = ASN1_TIME

The raw C type.
Source§

type Ref = Asn1TimeRef

The type representing a reference to this type.
Source§

unsafe fn from_ptr(ptr: *mut ASN1_TIME) -> Asn1Time

Constructs an instance of this type from its raw type.
Source§

fn as_ptr(&self) -> *mut ASN1_TIME

Returns a raw pointer to the wrapped value.
Source§

impl<'a> PartialEq<&'a Asn1TimeRef> for Asn1Time

Source§

fn eq(&self, other: &&'a Asn1TimeRef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Asn1Time> for &Asn1TimeRef

Source§

fn eq(&self, other: &Asn1Time) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Asn1Time> for Asn1TimeRef

Source§

fn eq(&self, other: &Asn1Time) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Asn1TimeRef> for Asn1Time

Source§

fn eq(&self, other: &Asn1TimeRef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Asn1Time

Source§

fn eq(&self, other: &Asn1Time) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialOrd<&'a Asn1TimeRef> for Asn1Time

Source§

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 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Asn1Time> for &Asn1TimeRef

Source§

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 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Asn1Time> for Asn1TimeRef

Source§

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 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Asn1TimeRef> for Asn1Time

Source§

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 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd for Asn1Time

Source§

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 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Send for Asn1Time

Source§

impl Sync for Asn1Time

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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