[][src]Struct exonum::helpers::Round

pub struct Round(pub u32);

Consensus round index.

Methods

impl Round[src]

pub fn zero() -> Self[src]

Returns zero value of the round.

Examples

use exonum::helpers::Round;

let round = Round::zero();
assert_eq!(0, round.0);

pub fn first() -> Self[src]

Returns first value of the round.

Examples

use exonum::helpers::Round;

let round = Round::first();
assert_eq!(1, round.0);

pub fn next(self) -> Self[src]

Returns next value of the round.

Examples

use exonum::helpers::Round;

let round = Round(20);
let next_round = round.next();
assert_eq!(21, next_round.0);

pub fn previous(self) -> Self[src]

Returns previous value of the round.

Panics

Panics if self.0 is equal to zero.

Examples

use exonum::helpers::Round;

let round = Round(10);
let previous_round = round.previous();
assert_eq!(9, previous_round.0);

pub fn increment(&mut self)[src]

Increments the round value.

Examples

use exonum::helpers::Round;

let mut round = Round::zero();
round.increment();
assert_eq!(1, round.0);

pub fn decrement(&mut self)[src]

Decrements the round value.

Panics

Panics if self.0 is equal to zero.

Examples

use exonum::helpers::Round;

let mut round = Round(20);
round.decrement();
assert_eq!(19, round.0);

pub fn iter_to(self, to: Self) -> impl Iterator<Item = Self>[src]

Returns the iterator over rounds in the range from self to to - 1.

Examples

use exonum::helpers::Round;

let round = Round::zero();
let mut iter = round.iter_to(Round(2));
assert_eq!(Some(Round(0)), iter.next());
assert_eq!(Some(Round(1)), iter.next());
assert_eq!(None, iter.next());

Trait Implementations

impl BinaryValue for Round[src]

impl Clone for Round[src]

impl Copy for Round[src]

impl Debug for Round[src]

impl<'de> Deserialize<'de> for Round[src]

impl Display for Round[src]

impl Eq for Round[src]

impl From<Round> for u32[src]

impl From<Round> for u64[src]

impl Hash for Round[src]

impl ObjectHash for Round[src]

impl Ord for Round[src]

impl PartialEq<Round> for Round[src]

impl PartialOrd<Round> for Round[src]

impl ProtobufConvert for Round[src]

type ProtoStruct = u32

Type generated from the Protobuf definition.

impl Serialize for Round[src]

impl StructuralEq for Round[src]

impl StructuralPartialEq for Round[src]

Auto Trait Implementations

impl RefUnwindSafe for Round

impl Send for Round

impl Sync for Round

impl Unpin for Round

impl UnwindSafe for Round

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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