[−][src]Struct exonum::helpers::Round
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]
fn to_bytes(&self) -> Vec<u8>
[src]
fn from_bytes(value: Cow<[u8]>) -> Result<Self>
[src]
fn into_bytes(self) -> Vec<u8>
[src]
impl Clone for Round
[src]
impl Copy for Round
[src]
impl Debug for Round
[src]
impl<'de> Deserialize<'de> for Round
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl ObjectHash for Round
[src]
fn object_hash(&self) -> Hash
[src]
impl Ord for Round
[src]
fn cmp(&self, other: &Round) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Round> for Round
[src]
impl PartialOrd<Round> for Round
[src]
fn partial_cmp(&self, other: &Round) -> Option<Ordering>
[src]
fn lt(&self, other: &Round) -> bool
[src]
fn le(&self, other: &Round) -> bool
[src]
fn gt(&self, other: &Round) -> bool
[src]
fn ge(&self, other: &Round) -> bool
[src]
impl ProtobufConvert for Round
[src]
type ProtoStruct = u32
Type generated from the Protobuf definition.
fn to_pb(&self) -> Self::ProtoStruct
[src]
fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>
[src]
impl Serialize for Round
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,