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])
| 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 | /// |