Struct openssl::asn1::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

§

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

§

type CType = ASN1_TIME

The raw C type.
§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Asn1Time> for Asn1Time

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a> PartialOrd<Asn1Time> for &'a 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Asn1Time> 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

This method 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

This method 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

This method 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

This method 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

This method 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

This method 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

This method 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

This method 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

This method 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

This method 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

This method 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

This method 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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.