pub struct Round(pub u32);Expand description
Consensus round index.
Tuple Fields§
§0: u32Implementations§
Source§impl Round
impl Round
Sourcepub fn zero() -> Self
pub fn zero() -> Self
Returns zero value of the round.
§Examples
use exonum::helpers::Round;
let round = Round::zero();
assert_eq!(0, round.0);Sourcepub fn first() -> Self
pub fn first() -> Self
Returns first value of the round.
§Examples
use exonum::helpers::Round;
let round = Round::first();
assert_eq!(1, round.0);Sourcepub fn next(self) -> Self
pub fn next(self) -> Self
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);Sourcepub fn increment(&mut self)
pub fn increment(&mut self)
Increments the round value.
§Examples
use exonum::helpers::Round;
let mut round = Round::zero();
round.increment();
assert_eq!(1, round.0);Sourcepub fn iter_to(self, to: Self) -> impl Iterator<Item = Self>
pub fn iter_to(self, to: Self) -> impl Iterator<Item = Self>
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§
Source§impl BinaryValue for Round
impl BinaryValue for Round
Source§impl<'de> Deserialize<'de> for Round
impl<'de> Deserialize<'de> for Round
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl ObjectHash for Round
impl ObjectHash for Round
Source§fn object_hash(&self) -> Hash
fn object_hash(&self) -> Hash
Returns a hash of the value. Read more
Source§impl Ord for Round
impl Ord for Round
Source§impl PartialOrd for Round
impl PartialOrd for Round
Source§impl ProtobufConvert for Round
impl ProtobufConvert for Round
Source§type ProtoStruct = u32
type ProtoStruct = u32
Type generated from the Protobuf definition.
Source§fn to_pb(&self) -> Self::ProtoStruct
fn to_pb(&self) -> Self::ProtoStruct
Performs conversion to the type generated from Protobuf.
impl Copy for Round
impl Eq for Round
impl StructuralPartialEq for Round
Auto Trait Implementations§
impl Freeze for Round
impl RefUnwindSafe for Round
impl Send for Round
impl Sync for Round
impl Unpin for Round
impl UnwindSafe for Round
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