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

Method create_leaf

atomic-core/src/crdt/apply/traits.rs:440–451  ·  view source on GitHub ↗

Creates a new leaf (token) in a branch. # Arguments `id` - The leaf ID `branch_id` - The parent branch `kind` - The token kind `content_range` - Byte range in the content blob `after` - Insert after this leaf, or `None` for start

(
        &mut self,
        id: LeafId,
        branch_id: BranchId,
        kind: TokenKind,
        content_range: Range<u32>,
        after: Option<LeafId>,
    )

Source from the content-addressed store, hash-verified

438 /// * `content_range` - Byte range in the content blob
439 /// * `after` - Insert after this leaf, or `None` for start
440 fn create_leaf(
441 &mut self,
442 id: LeafId,
443 branch_id: BranchId,
444 kind: TokenKind,
445 content_range: Range<u32>,
446 after: Option<LeafId>,
447 ) -> Result<Leaf, Self::Error> {
448 let leaf = Leaf::new(id, branch_id, kind, content_range);
449 self.put_leaf(&leaf, after)?;
450 Ok(leaf)
451 }
452
453 /// Marks a leaf as deleted.
454 fn mark_leaf_deleted(&mut self, id: LeafId) -> Result<(), Self::Error> {

Callers 2

test_create_leafFunction · 0.80
test_mark_leaf_deletedFunction · 0.80

Implementers 1

traits.rsatomic-core/src/crdt/apply/traits.rs

Calls 1

put_leafMethod · 0.45

Tested by 2

test_create_leafFunction · 0.64
test_mark_leaf_deletedFunction · 0.64