pub struct Timestamp(/* private fields */);Expand description
A UTC instant with canonical microsecond precision.
The stable wire form is exactly YYYY-MM-DDTHH:MM:SS.ffffffZ. Years are
bounded to 0000..=9999, offsets other than Z are rejected, leap seconds
are not represented, and precision is never silently truncated.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub const fn from_unix_micros(value: i64) -> Result<Self, TimestampError>
pub const fn from_unix_micros(value: i64) -> Result<Self, TimestampError>
Constructs a timestamp from microseconds relative to the Unix epoch.
§Errors
Returns TimestampError::OutOfRange when the value lies outside the
canonical four-digit year range.
Sourcepub const fn unix_micros(self) -> i64
pub const fn unix_micros(self) -> i64
Returns microseconds relative to the Unix epoch.
Sourcepub fn to_system_time(self) -> Result<SystemTime, TimestampError>
pub fn to_system_time(self) -> Result<SystemTime, TimestampError>
Converts this timestamp to SystemTime.
§Errors
Returns TimestampError::SystemTimeOutOfRange if the platform cannot
represent this otherwise valid timestamp.
Trait Implementations§
impl Copy for Timestamp
Source§impl<'de> Deserialize<'de> for Timestamp
impl<'de> Deserialize<'de> for Timestamp
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Timestamp
Source§impl JsonSchema for Timestamp
impl JsonSchema for Timestamp
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(_: &mut SchemaGenerator) -> Schema
fn json_schema(_: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl Ord for Timestamp
impl Ord for Timestamp
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
impl StructuralPartialEq for Timestamp
Source§impl TryFrom<SystemTime> for Timestamp
impl TryFrom<SystemTime> for Timestamp
Source§type Error = TimestampError
type Error = TimestampError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Forget for Timestamp
impl Freeze for Timestamp
impl Move for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnsafeUnpin for Timestamp
impl UnwindSafe for Timestamp
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
Mutably borrows from an owned value. Read more