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

Method equals

atomic-core/src/diff/line.rs:311–317  ·  view source on GitHub ↗

Compare two lines for equality, optionally ignoring trailing newline differences. When `strict` is true, lines must match exactly including trailing newlines. When `strict` is false, a line ending in newline can match one without (useful for comparing last lines of files). # Arguments `other` - The line to compare with `strict` - Whether to require exact match including newlines # Example ```

(&self, other: &Self, strict: bool)

Source from the content-addressed store, hash-verified

309 /// assert!(line1.equals(&line2, false)); // Lenient: same content
310 /// ```
311 pub fn equals(&self, other: &Self, strict: bool) -> bool {
312 if strict {
313 self.content == other.content
314 } else {
315 self.content_without_newline() == other.content_without_newline()
316 }
317 }
318}
319
320impl<'a> PartialEq for Line<'a> {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected