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

Method put_branch

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

Branch methods

(
            &mut self,
            branch: &Branch,
            _after: Option<BranchId>,
        )

Source from the content-addressed store, hash-verified

496
497 // Branch methods
498 fn put_branch(
499 &mut self,
500 branch: &Branch,
501 _after: Option<BranchId>,
502 ) -> Result<bool, Self::Error> {
503 let is_new = !self.branches.contains_key(&branch.id());
504 self.branches.insert(branch.id(), branch.clone());
505 self.trunk_branches
506 .entry(branch.trunk())
507 .or_default()
508 .push(branch.id());
509 Ok(is_new)
510 }
511
512 fn get_branch(&self, id: BranchId) -> Result<Option<Branch>, Self::Error> {
513 Ok(self.branches.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
trunkMethod · 0.45

Tested by

no test coverage detected