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

Method output_line

atomic-core/src/output/repo/writer.rs:374–404  ·  view source on GitHub ↗
(&mut self, node: GraphNode<NodeId>, get_contents: F)

Source from the content-addressed store, hash-verified

372
373impl<W: Write> VertexBuffer for ConflictWriter<W> {
374 fn output_line<E, F>(&mut self, node: GraphNode<NodeId>, get_contents: F) -> Result<(), E>
375 where
376 E: From<std::io::Error>,
377 F: FnOnce(&mut [u8]) -> Result<(), E>,
378 {
379 // Calculate node length
380 let len = (node.end.get() - node.start.get()) as usize;
381 if len == 0 {
382 return Ok(());
383 }
384
385 // Resize buffer and get contents
386 self.content_buffer.clear();
387 self.content_buffer.resize(len, 0);
388 get_contents(&mut self.content_buffer)?;
389
390 // Track line endings
391 let ends_with_newline = self.content_buffer.ends_with(b"\n");
392 self.line += Self::count_newlines(&self.content_buffer);
393
394 // Write to underlying writer
395 self.writer.write_all(&self.content_buffer)?;
396 self.bytes_written += len as u64;
397
398 // Update line start tracking
399 if !self.content_buffer.is_empty() {
400 self.at_line_start = ends_with_newline;
401 }
402
403 Ok(())
404 }
405
406 fn output_conflict_marker(
407 &mut self,

Callers 5

output_graph_contentFunction · 0.45
test_output_line_basicFunction · 0.45
test_output_line_emptyFunction · 0.45

Calls 3

getMethod · 0.65
clearMethod · 0.65
is_emptyMethod · 0.45

Tested by 3

test_output_line_basicFunction · 0.36
test_output_line_emptyFunction · 0.36