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

Method put_leaf

atomic-core/src/crdt/apply/leaf.rs:555–563  ·  view source on GitHub ↗

Leaf methods

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

Source from the content-addressed store, hash-verified

553
554 // Leaf methods
555 fn put_leaf(&mut self, leaf: &Leaf, _after: Option<LeafId>) -> Result<bool, Self::Error> {
556 let is_new = !self.leaves.contains_key(&leaf.id());
557 self.leaves.insert(leaf.id(), leaf.clone());
558 self.branch_leaves
559 .entry(leaf.branch())
560 .or_default()
561 .push(leaf.id());
562 Ok(is_new)
563 }
564
565 fn get_leaf(&self, id: LeafId) -> Result<Option<Leaf>, Self::Error> {
566 Ok(self.leaves.get(&id).cloned())

Callers 1

apply_insertFunction · 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

no test coverage detected