pub struct Epoch<Ts = u128>where
Ts: RawTimestamp,{ /* private fields */ }
Expand description
Implementations§
Source§impl<Ts> Epoch<Ts>where
Ts: RawTimestamp,
impl<Ts> Epoch<Ts>where
Ts: RawTimestamp,
Sourcepub const fn new(size: u128, timestamp: Ts) -> Self
pub const fn new(size: u128, timestamp: Ts) -> Self
returns a new instance of the Epoch
using the given size and timestamp.
Sourcepub const fn size(&self) -> u128
pub const fn size(&self) -> u128
The size of the epoch; epochs generally consider the number of steps, or size, (e.g. the number of seconds) that will need to be taken before the epoch is considered to be complete and a new one begins.
Sourcepub const fn timestamp(&self) -> &Timestamp<Ts>
pub const fn timestamp(&self) -> &Timestamp<Ts>
returns an immutable reference to the timestamp
Sourcepub fn with_size(self, size: u128) -> Self
pub fn with_size(self, size: u128) -> Self
consumes the current instance to create another with the given size and current timestamp.
Sourcepub fn with_timestamp<U: RawTimestamp>(self, timestamp: U) -> Epoch<U>
pub fn with_timestamp<U: RawTimestamp>(self, timestamp: U) -> Epoch<U>
consumes the current instance to create another with the given timestamp and current size.
Trait Implementations§
Source§impl<'de, Ts> Deserialize<'de> for Epoch<Ts>where
Ts: RawTimestamp + Deserialize<'de>,
impl<'de, Ts> Deserialize<'de> for Epoch<Ts>where
Ts: RawTimestamp + Deserialize<'de>,
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
Source§impl<Ts> Ord for Epoch<Ts>where
Ts: RawTimestamp + Ord,
impl<Ts> Ord for Epoch<Ts>where
Ts: RawTimestamp + Ord,
Source§impl<Ts> PartialOrd for Epoch<Ts>where
Ts: RawTimestamp + PartialOrd,
impl<Ts> PartialOrd for Epoch<Ts>where
Ts: RawTimestamp + PartialOrd,
impl<Ts> Copy for Epoch<Ts>where
Ts: RawTimestamp + Copy,
impl<Ts> Eq for Epoch<Ts>where
Ts: RawTimestamp + Eq,
impl<Ts> StructuralPartialEq for Epoch<Ts>where
Ts: RawTimestamp,
Auto Trait Implementations§
impl<Ts> Freeze for Epoch<Ts>where
Ts: Freeze,
impl<Ts> RefUnwindSafe for Epoch<Ts>where
Ts: RefUnwindSafe,
impl<Ts> Send for Epoch<Ts>where
Ts: Send,
impl<Ts> Sync for Epoch<Ts>where
Ts: Sync,
impl<Ts> Unpin for Epoch<Ts>where
Ts: Unpin,
impl<Ts> UnwindSafe for Epoch<Ts>where
Ts: UnwindSafe,
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