[go: up one dir, main page]

Struct der::GeneralizedTime[][src]

pub struct GeneralizedTime(_);
Expand description

ASN.1 GeneralizedTime type.

This type implements the validity requirements specified in RFC 5280 Section 4.1.2.5.2, namely:

For the purposes of this profile, GeneralizedTime values MUST be expressed in Greenwich Mean Time (Zulu) and MUST include seconds (i.e., times are YYYYMMDDHHMMSSZ), even where the number of seconds is zero. GeneralizedTime values MUST NOT include fractional seconds.

Implementations

impl GeneralizedTime[src]

pub const LENGTH: Length[src]

Length of an RFC 5280-flavored ASN.1 DER-encoded GeneralizedTime.

pub const fn length() -> Length[src]

👎 Deprecated since 0.3.3:

please use GeneralizedTime::LENGTH

Length of an RFC 5280-flavored ASN.1 DER-encoded GeneralizedTime.

pub fn new(unix_duration: Duration) -> Result<Self>[src]

Create a new GeneralizedTime given a Duration since UNIX_EPOCH (a.k.a. “Unix time”)

pub fn unix_duration(&self) -> Duration[src]

Get the duration of this timestamp since UNIX_EPOCH.

pub fn from_system_time(time: SystemTime) -> Result<Self>[src]

This is supported on crate feature std only.

Instantiate from SystemTime.

pub fn to_system_time(&self) -> SystemTime[src]

This is supported on crate feature std only.

Convert to SystemTime.

Trait Implementations

impl Clone for GeneralizedTime[src]

fn clone(&self) -> GeneralizedTime[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for GeneralizedTime[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Encodable for GeneralizedTime[src]

fn encoded_len(&self) -> Result<Length>[src]

Compute the length of this value in bytes when encoded as ASN.1 DER.

fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>[src]

Encode this value as ASN.1 DER using the provided Encoder.

fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>[src]

Encode this value to the provided byte slice, returning a sub-slice containing the encoded message. Read more

fn encode_to_vec(&self, buf: &mut Vec<u8>) -> Result<Length>[src]

This is supported on crate feature alloc only.

Encode this message as ASN.1 DER, appending it to the provided byte vector. Read more

fn to_vec(&self) -> Result<Vec<u8>>[src]

This is supported on crate feature alloc only.

Serialize this message as a byte vector.

impl From<&'_ GeneralizedTime> for GeneralizedTime[src]

fn from(value: &GeneralizedTime) -> GeneralizedTime[src]

Performs the conversion.

impl Ord for GeneralizedTime[src]

fn cmp(&self, other: &GeneralizedTime) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<GeneralizedTime> for GeneralizedTime[src]

fn eq(&self, other: &GeneralizedTime) -> bool[src]

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

fn ne(&self, other: &GeneralizedTime) -> bool[src]

This method tests for !=.

impl PartialOrd<GeneralizedTime> for GeneralizedTime[src]

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

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

#[must_use]
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]
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]
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]
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 Tagged for GeneralizedTime[src]

const TAG: Tag[src]

ASN.1 tag

impl TryFrom<Any<'_>> for GeneralizedTime[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(any: Any<'_>) -> Result<GeneralizedTime>[src]

Performs the conversion.

impl Copy for GeneralizedTime[src]

impl Eq for GeneralizedTime[src]

impl StructuralEq for GeneralizedTime[src]

impl StructuralPartialEq for GeneralizedTime[src]

Auto Trait Implementations

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> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.