pub struct StmParameters {
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 StmParameters
impl StmParameters
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 StmParameters
impl Clone for StmParameters
source§fn clone(&self) -> StmParameters
fn clone(&self) -> StmParameters
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 StmParameters
impl Debug for StmParameters
source§impl<'de> Deserialize<'de> for StmParameters
impl<'de> Deserialize<'de> for StmParameters
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 StmParameters
impl PartialEq for StmParameters
source§impl Serialize for StmParameters
impl Serialize for StmParameters
impl Copy for StmParameters
impl StructuralPartialEq for StmParameters
Auto Trait Implementations§
impl Freeze for StmParameters
impl RefUnwindSafe for StmParameters
impl Send for StmParameters
impl Sync for StmParameters
impl Unpin for StmParameters
impl UnwindSafe for StmParameters
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)