# Struct openssl::asn1::Asn1Time [−] [src]

    pub struct Asn1Time(_);

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

### `impl Asn1Time` [src]

#### `pub fn days_from_now(days: u32) -> Result<Asn1Time, ErrorStack>` [src]

Creates a new time on specified interval in days from now

#### `pub fn from_unix(time: time_t) -> Result<Asn1Time, ErrorStack>` [src]

Creates a new time from the specified `time_t` value

#### `pub fn from_str(s: &str) -> Result<Asn1Time, ErrorStack>` [src]

Creates a new time corresponding to the specified ASN1 time string.

This corresponds to `ASN1_TIME_set_string`.

#### `pub fn from_str_x509(s: &str) -> Result<Asn1Time, ErrorStack>` [src]

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>

#### `pub fn diff(&self, compare: &Self) -> Result<TimeDiff, ErrorStack>` [src]

Find difference between two times

This corresponds to `ASN1_TIME_diff`.

#### `pub fn compare(&self, other: &Self) -> Result<Ordering, ErrorStack>` [src]

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

### `impl AsRef<Asn1TimeRef> for Asn1Time` [src]

#### `fn as_ref(&self) -> &Asn1TimeRef` [src]

Performs the conversion.

### `impl Borrow<Asn1TimeRef> for Asn1Time` [src]

#### `fn borrow(&self) -> &Asn1TimeRef` [src]

Immutably borrows from an owned value. Read more

### `impl Deref for Asn1Time` [src]

#### `type Target = Asn1TimeRef`

The resulting type after dereferencing.

#### `fn deref(&self) -> &Asn1TimeRef` [src]

Dereferences the value.

### `impl DerefMut for Asn1Time` [src]

#### `fn deref_mut(&mut self) -> &mut Asn1TimeRef` [src]

Mutably dereferences the value.

### `impl Drop for Asn1Time` [src]

#### `fn drop(&mut self)` [src]

Executes the destructor for this type. Read more

### `impl ForeignType for Asn1Time` [src]

#### `type CType = ASN1_TIME`

The raw C type.

#### `type Ref = Asn1TimeRef`

The type representing a reference to this type.

#### `unsafe fn from_ptr(ptr: *mut ASN1_TIME) -> Asn1Time` [src]

Constructs an instance of this type from its raw type.

#### `fn as_ptr(&self) -> *mut ASN1_TIME` [src]

Returns a raw pointer to the wrapped value.

### `impl<'a> PartialEq<&'a Asn1TimeRef> for Asn1Time` [src]

#### `fn eq(&self, other: &&'a Asn1TimeRef) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `#[must_use]pub fn ne(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests for `!=`.

### `impl PartialEq<Asn1Time> for Asn1TimeRef` [src]

#### `fn eq(&self, other: &Asn1Time) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `#[must_use]pub fn ne(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests for `!=`.

### `impl<'a> PartialEq<Asn1Time> for &'a Asn1TimeRef` [src]

#### `fn eq(&self, other: &Asn1Time) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `#[must_use]pub fn ne(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests for `!=`.

### `impl PartialEq<Asn1Time> for Asn1Time` [src]

#### `fn eq(&self, other: &Asn1Time) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `#[must_use]pub fn ne(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests for `!=`.

### `impl PartialEq<Asn1TimeRef> for Asn1Time` [src]

#### `fn eq(&self, other: &Asn1TimeRef) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `#[must_use]pub fn ne(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests for `!=`.

### `impl<'a> PartialOrd<&'a Asn1TimeRef> for Asn1Time` [src]

#### `fn partial_cmp(&self, other: &&'a Asn1TimeRef) -> Option<Ordering>` [src]

This method returns an ordering between `self` and `other` values if one exists. Read more

#### `#[must_use]pub fn lt(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests less than (for `self` and `other`) and is used by the `<` operator. Read more

#### `#[must_use]pub fn le(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. Read more

#### `#[must_use]pub fn gt(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests greater than (for `self` and `other`) and is used by the `>` operator. Read more

#### `#[must_use]pub fn ge(&self, other: &Rhs) -> bool` 1.0.0 [src]

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

### `impl PartialOrd<Asn1Time> for Asn1TimeRef` [src]

#### `fn partial_cmp(&self, other: &Asn1Time) -> Option<Ordering>` [src]

This method returns an ordering between `self` and `other` values if one exists. Read more

#### `#[must_use]pub fn lt(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests less than (for `self` and `other`) and is used by the `<` operator. Read more

#### `#[must_use]pub fn le(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. Read more

#### `#[must_use]pub fn gt(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests greater than (for `self` and `other`) and is used by the `>` operator. Read more

#### `#[must_use]pub fn ge(&self, other: &Rhs) -> bool` 1.0.0 [src]

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

### `impl<'a> PartialOrd<Asn1Time> for &'a Asn1TimeRef` [src]

#### `fn partial_cmp(&self, other: &Asn1Time) -> Option<Ordering>` [src]

This method returns an ordering between `self` and `other` values if one exists. Read more

#### `#[must_use]pub fn lt(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests less than (for `self` and `other`) and is used by the `<` operator. Read more

#### `#[must_use]pub fn le(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. Read more

#### `#[must_use]pub fn gt(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests greater than (for `self` and `other`) and is used by the `>` operator. Read more

#### `#[must_use]pub fn ge(&self, other: &Rhs) -> bool` 1.0.0 [src]

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

### `impl PartialOrd<Asn1Time> for Asn1Time` [src]

#### `fn partial_cmp(&self, other: &Asn1Time) -> Option<Ordering>` [src]

This method returns an ordering between `self` and `other` values if one exists. Read more

#### `#[must_use]pub fn lt(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests less than (for `self` and `other`) and is used by the `<` operator. Read more

#### `#[must_use]pub fn le(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. Read more

#### `#[must_use]pub fn gt(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests greater than (for `self` and `other`) and is used by the `>` operator. Read more

#### `#[must_use]pub fn ge(&self, other: &Rhs) -> bool` 1.0.0 [src]

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

### `impl PartialOrd<Asn1TimeRef> for Asn1Time` [src]

#### `fn partial_cmp(&self, other: &Asn1TimeRef) -> Option<Ordering>` [src]

This method returns an ordering between `self` and `other` values if one exists. Read more

#### `#[must_use]pub fn lt(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests less than (for `self` and `other`) and is used by the `<` operator. Read more

#### `#[must_use]pub fn le(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. Read more

#### `#[must_use]pub fn gt(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests greater than (for `self` and `other`) and is used by the `>` operator. Read more

#### `#[must_use]pub fn ge(&self, other: &Rhs) -> bool` 1.0.0 [src]

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

### `impl Send for Asn1Time` [src]

### `impl Sync for Asn1Time` [src]

## Auto Trait Implementations

### `impl RefUnwindSafe for Asn1Time`

### `impl Unpin for Asn1Time`

### `impl UnwindSafe for Asn1Time`

## Blanket Implementations

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<T> From<T> for T` [src]

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

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

The type returned in the event of a conversion error.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.