pub struct Epoch(pub u64);Expand description
Epoch struct, which is a wrapper around epoch number and timestamp.
Tuple Fields§
§0: u64Implementations§
Source§impl Epoch
impl Epoch
Sourcepub fn to_be_bytes(self) -> [u8; 8]
pub fn to_be_bytes(self) -> [u8; 8]
Returns epoch number as bytes.
Sourcepub fn current_epoch(interval: u64) -> Result<Self, EigenError>
pub fn current_epoch(interval: u64) -> Result<Self, EigenError>
Calculates the current epoch number based on the interval duration.
Sourcepub fn secs_until_next_epoch(interval: u64) -> Result<u64, EigenError>
pub fn secs_until_next_epoch(interval: u64) -> Result<u64, EigenError>
Calculates the seconds until the next epoch based on the interval duration.
Sourcepub fn current_timestamp() -> Result<u64, EigenError>
pub fn current_timestamp() -> Result<u64, EigenError>
Calculates the current timestamp. The difference between UNIX timestamp start and now.
Trait Implementations§
impl Copy for Epoch
impl Eq for Epoch
impl StructuralPartialEq for Epoch
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more