pub struct Parameters {
pub m: u64,
pub k: u64,
pub phi_f: f64,
}
Expand description
Used to set protocol parameters.
Fields§
§m: u64
Security parameter, upper bound on indices.
k: u64
Quorum parameter.
phi_f: f64
f
in phi(w) = 1 - (1 - f)^w, where w is the stake of a participant..
Implementations§
Source§impl Parameters
impl Parameters
Sourcepub fn to_bytes(&self) -> [u8; 24]
pub fn to_bytes(&self) -> [u8; 24]
Convert to bytes
§Layout
- Security parameter,
m
(as u64) - Quorum parameter,
k
(as u64) - Phi f, as (f64)
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, RegisterError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, RegisterError>
Extract the StmParameters
from a byte slice.
§Error
The function fails if the given string of bytes is not of required size.
Trait Implementations§
Source§impl Clone for Parameters
impl Clone for Parameters
Source§fn clone(&self) -> Parameters
fn clone(&self) -> Parameters
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Parameters
impl Debug for Parameters
Source§impl<'de> Deserialize<'de> for Parameters
impl<'de> Deserialize<'de> for Parameters
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 PartialEq for Parameters
impl PartialEq for Parameters
Source§impl Serialize for Parameters
impl Serialize for Parameters
impl Copy for Parameters
impl StructuralPartialEq for Parameters
Auto Trait Implementations§
impl Freeze for Parameters
impl RefUnwindSafe for Parameters
impl Send for Parameters
impl Sync for Parameters
impl Unpin for Parameters
impl UnwindSafe for Parameters
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