pub struct EpochNumberWithFraction(_);
Expand description

Represents an epoch number with a fraction unit, it can be used to accurately represent the position for a block within an epoch.

Implementations

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

TODO(doc): @quake

Estimate the floor limit of epoch number after N blocks.

Since we couldn’t know the length of next epoch before reach the next epoch, this function could only return self.number() or self.number()+1.

TODO(doc): @quake

Converts from an unsigned 64 bits number without checks.

Notice

The EpochNumberWithFraction constructed by this method has a potential risk that when call self.to_rational() may lead to a panic if the user specifies a zero epoch length.

Prevents leading to a panic if the EpochNumberWithFraction is constructed without checks.

Converts the epoch to an unsigned 256 bits rational.

Panics

Only genesis epoch’s length could be zero, otherwise causes a division-by-zero panic.

Check if current value is another value’s successor.

Check the data format.

The epoch length should be greater than zero. The epoch index should be less than the epoch length.

Check the data format as an increment.

The epoch index should be less than the epoch length or both of them are zero.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

Packs a rust type into binary data.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Unpack binary data into rust types.

Unpack binary data into rust types.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.