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

Method put_leaf

atomic-core/src/crdt/apply/traits.rs:612–620  ·  view source on GitHub ↗
(&mut self, leaf: &Leaf, _after: Option<LeafId>)

Source from the content-addressed store, hash-verified

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

Callers 3

create_leafMethod · 0.45
test_list_leavesFunction · 0.45
test_update_leaf_contentFunction · 0.45

Calls 6

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

Tested by 2

test_list_leavesFunction · 0.36
test_update_leaf_contentFunction · 0.36