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

Method add_token

atomic-core/src/record/workflow/crdt/builder/leaf.rs:65–80  ·  view source on GitHub ↗

Adds a token to a line. # Arguments `branch_id` - The line to add the token to `after` - The leaf to insert after (None for start of line) `kind` - The token kind `content` - The token content

(
        &mut self,
        _branch_id: crate::crdt::BranchId,
        _after: Option<LeafId>,
        _kind: TokenKind,
        content: &[u8],
    )

Source from the content-addressed store, hash-verified

63 /// * `kind` - The token kind
64 /// * `content` - The token content
65 pub fn add_token(
66 &mut self,
67 _branch_id: crate::crdt::BranchId,
68 _after: Option<LeafId>,
69 _kind: TokenKind,
70 content: &[u8],
71 ) -> LeafId {
72 let leaf_id = self.alloc_leaf_id();
73 let _ = self.append_content(content);
74
75 // Note: In a full implementation, we would add this to the branch's leaf ops
76 // For now, we just track the allocation and stats
77 self.stats.tokens_added += 1;
78
79 leaf_id
80 }
81
82 /// Marks a token for deletion.
83 pub fn delete_token(&mut self, _leaf_id: LeafId) {

Callers 2

test_builder_add_tokenFunction · 0.45
test_builder_last_leafFunction · 0.45

Calls 2

alloc_leaf_idMethod · 0.45
append_contentMethod · 0.45

Tested by 2

test_builder_add_tokenFunction · 0.36
test_builder_last_leafFunction · 0.36