MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / put_leaf

Method put_leaf

atomic-core/src/crdt/apply/branch.rs:607–615  ·  view source on GitHub ↗

Leaf methods

(&mut self, leaf: &Leaf, _after: Option<LeafId>)

Source from the content-addressed store, hash-verified

605
606 // Leaf methods
607 fn put_leaf(&mut self, leaf: &Leaf, _after: Option<LeafId>) -> Result<bool, Self::Error> {
608 let is_new = !self.leaves.contains_key(&leaf.id());
609 self.leaves.insert(leaf.id(), leaf.clone());
610 self.branch_leaves
611 .entry(leaf.branch())
612 .or_default()
613 .push(leaf.id());
614 Ok(is_new)
615 }
616
617 fn get_leaf(&self, id: LeafId) -> Result<Option<Leaf>, Self::Error> {
618 Ok(self.leaves.get(&id).cloned())

Callers

nothing calls this directly

Calls 6

contains_keyMethod · 0.80
idMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45
pushMethod · 0.45
branchMethod · 0.45

Tested by

no test coverage detected