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

source

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.

source

pub fn epoch_start(&self) -> Epoch

retrieve the epoch start during a given Era

source

pub fn slot_start(&self) -> Slot

retrieve the slot start of an epoch during a given Era

source

pub fn slots_per_epoch(&self) -> u32

retrieve the number of slots in an epoch during a given Era

source

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.

source

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

§

type Parameters = ()

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default.
§

type Strategy = BoxedStrategy<TimeEra>

The type of Strategy used to generate values of type Self.
source§

fn arbitrary_with(args: <Self as Arbitrary>::Parameters) -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
source§

impl Arbitrary for TimeEra

source§

fn arbitrary<G: Gen>(g: &mut G) -> Self

§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>, Global>

source§

impl Clone for TimeEra

source§

fn clone(&self) -> TimeEra

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TimeEra

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<TimeEra> for TimeEra

source§

fn eq(&self, other: &TimeEra) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for TimeEra

source§

impl StructuralEq for TimeEra

source§

impl StructuralPartialEq for TimeEra

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V