Struct chain_time::era::TimeEra
source · pub struct TimeEra {
epoch_start: Epoch,
slot_start: Slot,
slots_per_epoch: u32,
}
Expand description
Describe a new era, which start at epoch_start and is associated to a specific slot. Each epoch have a constant number of slots on a given time era.
Fields§
§epoch_start: Epoch
§slot_start: Slot
§slots_per_epoch: u32
Implementations§
source§impl TimeEra
impl TimeEra
sourcepub fn new(slot_start: Slot, epoch_start: Epoch, slots_per_epoch: u32) -> Self
pub fn new(slot_start: Slot, epoch_start: Epoch, slots_per_epoch: u32) -> Self
Set a new era to start on slot_start at epoch_start for a given slots per epoch.
sourcepub fn epoch_start(&self) -> Epoch
pub fn epoch_start(&self) -> Epoch
retrieve the epoch start during a given Era
sourcepub fn slot_start(&self) -> Slot
pub fn slot_start(&self) -> Slot
retrieve the slot start of an epoch during a given Era
sourcepub fn slots_per_epoch(&self) -> u32
pub fn slots_per_epoch(&self) -> u32
retrieve the number of slots in an epoch during a given Era
sourcepub fn from_slot_to_era(&self, slot: Slot) -> Option<EpochPosition>
pub fn from_slot_to_era(&self, slot: Slot) -> Option<EpochPosition>
Try to return the epoch/inner-epoch-slot associated.
If the slot in parameter is before the beginning of this era, then None is returned.
sourcepub fn from_era_to_slot(&self, pos: EpochPosition) -> Slot
pub fn from_era_to_slot(&self, pos: EpochPosition) -> Slot
Convert an epoch position into a flat slot
Trait Implementations§
source§impl Arbitrary for TimeEra
impl Arbitrary for TimeEra
§type Parameters = ()
type Parameters = ()
The type of parameters that
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.source§fn arbitrary_with(args: <Self as Arbitrary>::Parameters) -> Self::Strategy
fn arbitrary_with(args: <Self as Arbitrary>::Parameters) -> Self::Strategy
source§impl PartialEq<TimeEra> for TimeEra
impl PartialEq<TimeEra> for TimeEra
impl Eq for TimeEra
impl StructuralEq for TimeEra
impl StructuralPartialEq for TimeEra
Auto Trait Implementations§
impl RefUnwindSafe for TimeEra
impl Send for TimeEra
impl Sync for TimeEra
impl Unpin for TimeEra
impl UnwindSafe for TimeEra
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