pub struct Epoch { /* private fields */ }
Expand description
A struct that provides conversions to/from epochs/date/time.
Implementations§
Source§impl 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§
Source§impl TryFrom<DateTimeParts> for Epoch
impl TryFrom<DateTimeParts> for Epoch
Source§fn try_from(parts: DateTimeParts) -> Result<Self>
fn try_from(parts: DateTimeParts) -> Result<Self>
Attempts to convert DateTimeParts into an Epoch
Source§type Error = EpochError
type Error = EpochError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for Epoch
impl RefUnwindSafe for Epoch
impl Send for Epoch
impl Sync for Epoch
impl Unpin for Epoch
impl UnwindSafe for Epoch
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