Struct x509_parser::time::ASN1Time
source · [−]pub struct ASN1Time(_);
Expand description
An ASN.1 timestamp.
Implementations
sourceimpl ASN1Time
impl ASN1Time
pub const fn new(dt: OffsetDateTime) -> Self
pub const fn to_datetime(&self) -> OffsetDateTime
sourcepub fn from_timestamp(secs: i64) -> Result<Self, X509Error>
pub fn from_timestamp(secs: i64) -> Result<Self, X509Error>
Makes a new ASN1Time
from the number of non-leap seconds since Epoch
sourcepub fn timestamp(&self) -> i64
pub fn timestamp(&self) -> i64
Returns the number of non-leap seconds since January 1, 1970 0:00:00 UTC (aka “UNIX timestamp”).
sourcepub fn to_rfc2822(self) -> Result<String, String>
pub fn to_rfc2822(self) -> Result<String, String>
Returns an RFC 2822 date and time string such as Tue, 1 Jul 2003 10:52:37 +0200
.
Conversion to RFC2822 date can fail if date cannot be represented in this format, for example if year < 1900.
For an infallible conversion to string, use .to_string()
.
Trait Implementations
sourceimpl From<OffsetDateTime> for ASN1Time
impl From<OffsetDateTime> for ASN1Time
sourcefn from(dt: OffsetDateTime) -> Self
fn from(dt: OffsetDateTime) -> Self
Converts to this type from the input type.
sourceimpl<'a> FromDer<'a, X509Error> for ASN1Time
impl<'a> FromDer<'a, X509Error> for ASN1Time
sourcefn from_der(i: &[u8]) -> X509Result<'_, Self>
fn from_der(i: &[u8]) -> X509Result<'_, Self>
Attempt to parse input bytes into a DER object (enforcing constraints)
sourceimpl Ord for ASN1Time
impl Ord for ASN1Time
sourceimpl PartialOrd<ASN1Time> for ASN1Time
impl PartialOrd<ASN1Time> for ASN1Time
sourcefn partial_cmp(&self, other: &ASN1Time) -> Option<Ordering>
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 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn le(&self, other: &Rhs) -> bool
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
impl Copy for ASN1Time
impl Eq for ASN1Time
impl StructuralEq for ASN1Time
impl StructuralPartialEq for ASN1Time
Auto Trait Implementations
impl RefUnwindSafe for ASN1Time
impl Send for ASN1Time
impl Sync for ASN1Time
impl Unpin for ASN1Time
impl UnwindSafe for ASN1Time
Blanket Implementations
sourceimpl<'a, T, E> AsTaggedExplicit<'a, E> for T where
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for T where
T: 'a,
sourceimpl<'a, T, E> AsTaggedImplicit<'a, E> for T where
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for T where
T: 'a,
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more