Branch methods
(
&mut self,
branch: &Branch,
_after: Option<BranchId>,
)
| 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()) |