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) -> Epoch<Ts>
pub const fn new(size: u128, timestamp: Ts) -> Epoch<Ts>
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) -> Epoch<Ts>
pub fn with_size(self, size: u128) -> Epoch<Ts>
consumes the current instance to create another with the given size and current timestamp.
Sourcepub fn with_timestamp<U>(self, timestamp: U) -> Epoch<U>where
U: RawTimestamp,
pub fn with_timestamp<U>(self, timestamp: U) -> Epoch<U>where
U: RawTimestamp,
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<Epoch<Ts>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Epoch<Ts>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<Ts> Ord for Epoch<Ts>where
Ts: Ord + RawTimestamp,
impl<Ts> Ord for Epoch<Ts>where
Ts: Ord + RawTimestamp,
Source§impl<Ts> PartialOrd for Epoch<Ts>where
Ts: PartialOrd + RawTimestamp,
impl<Ts> PartialOrd for Epoch<Ts>where
Ts: PartialOrd + RawTimestamp,
Source§impl<Ts> Serialize for Epoch<Ts>where
Ts: RawTimestamp + Serialize,
impl<Ts> Serialize for Epoch<Ts>where
Ts: RawTimestamp + Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<Ts> Copy for Epoch<Ts>where
Ts: Copy + RawTimestamp,
impl<Ts> Eq for Epoch<Ts>where
Ts: Eq + RawTimestamp,
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