pub struct Epoch { /* private fields */ }Expand description
A struct that provides conversions to/from epochs/date/time.
Implementations
sourceimpl Epoch
impl Epoch
sourcepub const fn new(datetime: OffsetDateTime) -> Epoch
pub const fn new(datetime: OffsetDateTime) -> Epoch
Instantiates a new Epoch
sourcepub fn from_parts(parts: DateTimeParts) -> Result<Epoch>
pub fn from_parts(parts: DateTimeParts) -> Result<Epoch>
Creates a new Epoch from DateTimeParts
sourcepub fn from_epoch_s(epoch_s: i64) -> Result<Epoch>
pub fn from_epoch_s(epoch_s: i64) -> Result<Epoch>
Creates an epoch from seconds
sourcepub fn from_epoch_ms(epoch_ms: i128) -> Result<Epoch>
pub fn from_epoch_ms(epoch_ms: i128) -> Result<Epoch>
Creates an epoch from milliseconds
sourcepub fn from_epoch_us(epoch_us: i128) -> Result<Epoch>
pub fn from_epoch_us(epoch_us: i128) -> Result<Epoch>
Creates an epoch from microseconds
sourcepub fn from_epoch_ns(epoch_ns: i128) -> Result<Epoch>
pub fn from_epoch_ns(epoch_ns: i128) -> Result<Epoch>
Creates an epoch from nanoseconds
Trait Implementations
sourceimpl TryFrom<DateTimeParts> for Epoch
impl TryFrom<DateTimeParts> for Epoch
sourcefn try_from(parts: DateTimeParts) -> Result<Self>
fn try_from(parts: DateTimeParts) -> Result<Self>
Attempts to convert DateTimeParts into an Epoch
type Error = EpochError
type Error = EpochError
The type returned in the event of a conversion error.
Auto Trait Implementations
impl RefUnwindSafe for Epoch
impl Send for Epoch
impl Sync for Epoch
impl Unpin for Epoch
impl UnwindSafe for Epoch
Blanket Implementations
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