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

Method ensure_line_start

atomic-core/src/output/repo/writer.rs:280–288  ·  view source on GitHub ↗

Ensure we're at the start of a line before writing a marker. If we're in the middle of a line, this writes a newline first.

(&mut self)

Source from the content-addressed store, hash-verified

278 ///
279 /// If we're in the middle of a line, this writes a newline first.
280 fn ensure_line_start(&mut self) -> std::io::Result<()> {
281 if !self.at_line_start {
282 self.writer.write_all(b"\n")?;
283 self.bytes_written += 1;
284 self.line += 1;
285 self.at_line_start = true;
286 }
287 Ok(())
288 }
289
290 /// Count newlines in a byte slice.
291 fn count_newlines(data: &[u8]) -> u32 {

Callers 1

write_markerMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected