Struct ed25519_dalek::pkcs8::spki::der::asn1::GeneralizedTime
pub struct GeneralizedTime(/* private fields */);
pkcs8
only.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
impl GeneralizedTime
pub const fn from_date_time(datetime: DateTime) -> GeneralizedTime
pub const fn from_date_time(datetime: DateTime) -> GeneralizedTime
Create a GeneralizedTime
from a DateTime
.
pub fn to_date_time(&self) -> DateTime
pub fn to_date_time(&self) -> DateTime
Convert this GeneralizedTime
into a DateTime
.
pub fn from_unix_duration(
unix_duration: Duration
) -> Result<GeneralizedTime, Error>
pub fn from_unix_duration( unix_duration: Duration ) -> Result<GeneralizedTime, Error>
Create a new GeneralizedTime
given a Duration
since UNIX_EPOCH
(a.k.a. “Unix time”)
pub fn to_unix_duration(&self) -> Duration
pub fn to_unix_duration(&self) -> Duration
Get the duration of this timestamp since UNIX_EPOCH
.
pub fn from_system_time(time: SystemTime) -> Result<GeneralizedTime, Error>
Available on crate feature std
only.
pub fn from_system_time(time: SystemTime) -> Result<GeneralizedTime, Error>
std
only.Instantiate from SystemTime
.
pub fn to_system_time(&self) -> SystemTime
Available on crate feature std
only.
pub fn to_system_time(&self) -> SystemTime
std
only.Convert to SystemTime
.
Trait Implementations§
§impl Clone for GeneralizedTime
impl Clone for GeneralizedTime
§fn clone(&self) -> GeneralizedTime
fn clone(&self) -> GeneralizedTime
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for GeneralizedTime
impl Debug for GeneralizedTime
§impl<'a> DecodeValue<'a> for GeneralizedTime
impl<'a> DecodeValue<'a> for GeneralizedTime
§fn decode_value<R>(
reader: &mut R,
header: Header
) -> Result<GeneralizedTime, Error>where
R: Reader<'a>,
fn decode_value<R>(
reader: &mut R,
header: Header
) -> Result<GeneralizedTime, Error>where
R: Reader<'a>,
Reader
.§impl EncodeValue for GeneralizedTime
impl EncodeValue for GeneralizedTime
§impl From<&DateTime> for GeneralizedTime
impl From<&DateTime> for GeneralizedTime
§fn from(datetime: &DateTime) -> GeneralizedTime
fn from(datetime: &DateTime) -> GeneralizedTime
§impl From<&GeneralizedTime> for DateTime
impl From<&GeneralizedTime> for DateTime
§fn from(utc_time: &GeneralizedTime) -> DateTime
fn from(utc_time: &GeneralizedTime) -> DateTime
§impl From<&GeneralizedTime> for GeneralizedTime
impl From<&GeneralizedTime> for GeneralizedTime
§fn from(value: &GeneralizedTime) -> GeneralizedTime
fn from(value: &GeneralizedTime) -> GeneralizedTime
§impl From<DateTime> for GeneralizedTime
impl From<DateTime> for GeneralizedTime
§fn from(datetime: DateTime) -> GeneralizedTime
fn from(datetime: DateTime) -> GeneralizedTime
§impl From<GeneralizedTime> for DateTime
impl From<GeneralizedTime> for DateTime
§fn from(utc_time: GeneralizedTime) -> DateTime
fn from(utc_time: GeneralizedTime) -> DateTime
§impl Ord for GeneralizedTime
impl Ord for GeneralizedTime
§impl PartialEq for GeneralizedTime
impl PartialEq for GeneralizedTime
§fn eq(&self, other: &GeneralizedTime) -> bool
fn eq(&self, other: &GeneralizedTime) -> bool
self
and other
values to be equal, and is used
by ==
.§impl PartialOrd for GeneralizedTime
impl PartialOrd for GeneralizedTime
§fn partial_cmp(&self, other: &GeneralizedTime) -> Option<Ordering>
fn partial_cmp(&self, other: &GeneralizedTime) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more§impl<'__der> TryFrom<&'__der Any> for GeneralizedTime
Available on crate feature alloc
only.
impl<'__der> TryFrom<&'__der Any> for GeneralizedTime
alloc
only.§impl TryFrom<&SystemTime> for GeneralizedTime
Available on crate feature std
only.
impl TryFrom<&SystemTime> for GeneralizedTime
std
only.§fn try_from(time: &SystemTime) -> Result<GeneralizedTime, Error>
fn try_from(time: &SystemTime) -> Result<GeneralizedTime, Error>
§impl<'__der> TryFrom<AnyRef<'__der>> for GeneralizedTime
impl<'__der> TryFrom<AnyRef<'__der>> for GeneralizedTime
§impl TryFrom<SystemTime> for GeneralizedTime
Available on crate feature std
only.
impl TryFrom<SystemTime> for GeneralizedTime
std
only.§fn try_from(time: SystemTime) -> Result<GeneralizedTime, Error>
fn try_from(time: SystemTime) -> Result<GeneralizedTime, Error>
impl Copy for GeneralizedTime
impl Eq for GeneralizedTime
impl StructuralPartialEq for GeneralizedTime
Auto Trait Implementations§
impl RefUnwindSafe for GeneralizedTime
impl Send for GeneralizedTime
impl Sync for GeneralizedTime
impl Unpin for GeneralizedTime
impl UnwindSafe for GeneralizedTime
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<'a, T> Choice<'a> for T
impl<'a, T> Choice<'a> for T
§fn can_decode(tag: Tag) -> bool
fn can_decode(tag: Tag) -> bool
Tag
decodable as a variant of this CHOICE
?§impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag,
impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag,
§impl<T> Encode for Twhere
T: EncodeValue + Tagged,
impl<T> Encode for Twhere
T: EncodeValue + Tagged,
§fn encoded_len(&self) -> Result<Length, Error>
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this value in bytes when encoded as ASN.1 DER.
§fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
Encode this value as ASN.1 DER using the provided Writer
.