Expand description
A node info.
Fields
address: Address
Node address.
propose_weight: u32
The propose weight of the node. The field is only effective in features = "random_leader"
.
vote_weight: u32
The vote weight of the node.
Implementations
sourceimpl Node
impl Node
sourcepub fn new(addr: Address) -> Self
pub fn new(addr: Address) -> Self
Create a new node with defaule propose weight 1
and vote weight 1
.
sourcepub fn set_propose_weight(&mut self, propose_weight: u32)
pub fn set_propose_weight(&mut self, propose_weight: u32)
Set a new propose weight of the node. Propose weight is only effective in features = "random_leader"
.
sourcepub fn set_vote_weight(&mut self, vote_weight: u32)
pub fn set_vote_weight(&mut self, vote_weight: u32)
Set a new vote weight of the node.
Trait Implementations
sourceimpl Decodable for Node
impl Decodable for Node
sourcefn decode(r: &Rlp<'_>) -> Result<Self, DecoderError>
fn decode(r: &Rlp<'_>) -> Result<Self, DecoderError>
Decode a value from RLP bytes
sourceimpl<'de> Deserialize<'de> for Node
impl<'de> Deserialize<'de> for Node
sourcefn 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
sourceimpl Ord for Node
impl Ord for Node
sourceimpl PartialOrd<Node> for Node
impl PartialOrd<Node> for Node
sourcefn partial_cmp(&self, other: &Node) -> Option<Ordering>
fn partial_cmp(&self, other: &Node) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Node
impl StructuralEq for Node
impl StructuralPartialEq for Node
Auto Trait Implementations
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more