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

Method new

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

Create a new line from a byte slice. The line's hash is computed immediately and cached for later use. # Arguments `content` - The raw bytes of the line (may include newline) # Example ```rust use atomic_core::diff::Line; let line = Line::new(b"hello world\n"); assert!(line.has_trailing_newline()); ```

(content: &'a [u8])

Source from the content-addressed store, hash-verified

112 /// assert!(line.has_trailing_newline());
113 /// ```
114 pub fn new(content: &'a [u8]) -> Self {
115 let trailing_newline = content.last() == Some(&b'\n');
116 let hash = Self::compute_hash(content);
117
118 Self {
119 content,
120 hash,
121 trailing_newline,
122 is_last: false,
123 }
124 }
125
126 /// Create a line marked as the last in a sequence.
127 ///

Callers

nothing calls this directly

Calls 1

lastMethod · 0.80

Tested by

no test coverage detected