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

Method output_line

atomic-repository/src/repository/conflict_object.rs:510–543  ·  view source on GitHub ↗
(
        &mut self,
        node: atomic_core::types::GraphNode<atomic_core::types::NodeId>,
        get_contents: F,
    )

Source from the content-addressed store, hash-verified

508
509impl atomic_core::output::VertexBuffer for ConflictCaptureWriter {
510 fn output_line<E, F>(
511 &mut self,
512 node: atomic_core::types::GraphNode<atomic_core::types::NodeId>,
513 get_contents: F,
514 ) -> Result<(), E>
515 where
516 E: From<std::io::Error>,
517 F: FnOnce(&mut [u8]) -> Result<(), E>,
518 {
519 let len = (node.end.get() - node.start.get()) as usize;
520 if len == 0 {
521 return Ok(());
522 }
523 let mut contents = vec![0u8; len];
524 get_contents(&mut contents)?;
525 if self.open.is_some() {
526 if self.current_side.is_none() {
527 self.current_side = Some(CapturedSide {
528 node,
529 content: Hash::of(b""),
530 marker_change: None,
531 });
532 self.side_start = self.out.len();
533 }
534 self.out.extend_from_slice(&contents);
535 self.line += contents.iter().filter(|&&b| b == b'\n').count() as u32;
536 self.at_line_start = contents.ends_with(b"\n");
537 } else {
538 self.out.extend_from_slice(&contents);
539 self.line += contents.iter().filter(|&&b| b == b'\n').count() as u32;
540 self.at_line_start = contents.ends_with(b"\n");
541 }
542 Ok(())
543 }
544
545 fn output_conflict_marker(
546 &mut self,

Callers

nothing calls this directly

Calls 5

is_noneMethod · 0.80
getMethod · 0.65
lenMethod · 0.45
countMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected