pub struct NodeBuilder {
parents: Vec<Hash>,
payload: Option<Payload>,
timestamp: u64,
creator: String,
}Expand description
Builder for creating Merkle nodes.
Fields§
§parents: Vec<Hash>§payload: Option<Payload>§timestamp: u64§creator: StringImplementations§
Source§impl NodeBuilder
impl NodeBuilder
Sourcepub fn with_parents(self, parents: Vec<Hash>) -> Self
pub fn with_parents(self, parents: Vec<Hash>) -> Self
Set the parent nodes.
Sourcepub fn with_parent(self, parent: Hash) -> Self
pub fn with_parent(self, parent: Hash) -> Self
Add a single parent node.
Sourcepub fn with_payload(self, payload: Payload) -> Self
pub fn with_payload(self, payload: Payload) -> Self
Set the payload.
Sourcepub fn with_timestamp(self, timestamp: u64) -> Self
pub fn with_timestamp(self, timestamp: u64) -> Self
Set the logical timestamp.
Sourcepub fn with_creator(self, creator: impl Into<String>) -> Self
pub fn with_creator(self, creator: impl Into<String>) -> Self
Set the creator replica ID.
Sourcepub fn build(self) -> MerkleNode
pub fn build(self) -> MerkleNode
Build the node, computing its CID.
Sourcepub fn genesis(creator: impl Into<String>) -> MerkleNode
pub fn genesis(creator: impl Into<String>) -> MerkleNode
Build a genesis node for a replica.
Trait Implementations§
Source§impl Clone for NodeBuilder
impl Clone for NodeBuilder
Source§fn clone(&self) -> NodeBuilder
fn clone(&self) -> NodeBuilder
Returns a duplicate 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 NodeBuilder
impl Debug for NodeBuilder
Source§impl Default for NodeBuilder
impl Default for NodeBuilder
Source§fn default() -> NodeBuilder
fn default() -> NodeBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for NodeBuilder
impl RefUnwindSafe for NodeBuilder
impl Send for NodeBuilder
impl Sync for NodeBuilder
impl Unpin for NodeBuilder
impl UnwindSafe for NodeBuilder
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