pub struct HashLineFile {
pub lines: Vec<HashLine>,
}Expand description
A complete file with line hashes.
Fields§
§lines: Vec<HashLine>Implementations§
Source§impl HashLineFile
impl HashLineFile
Sourcepub fn from_content(content: &str) -> Self
pub fn from_content(content: &str) -> Self
Build a HashLineFile from raw file content.
Sourcepub fn to_hashline_text(&self) -> String
pub fn to_hashline_text(&self) -> String
Render to the hashline text format: N:HHHH|content
Sourcepub fn find_by_hash(&self, hash: &LineHash) -> Vec<&HashLine>
pub fn find_by_hash(&self, hash: &LineHash) -> Vec<&HashLine>
Find all lines matching a given hash.
Sourcepub fn to_content(&self) -> String
pub fn to_content(&self) -> String
Reconstruct file content from lines.
Sourcepub fn apply_edits(
&self,
edits: &[HashLineEdit],
) -> Result<String, HashLineError>
pub fn apply_edits( &self, edits: &[HashLineEdit], ) -> Result<String, HashLineError>
Apply a set of edits, validating hashes and returning the new content.
Algorithm: validate all hashes → sort edits by line (reverse) → apply bottom-up.
Trait Implementations§
Source§impl Clone for HashLineFile
impl Clone for HashLineFile
Source§fn clone(&self) -> HashLineFile
fn clone(&self) -> HashLineFile
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HashLineFile
impl Debug for HashLineFile
Source§impl<'de> Deserialize<'de> for HashLineFile
impl<'de> Deserialize<'de> for HashLineFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HashLineFile
impl RefUnwindSafe for HashLineFile
impl Send for HashLineFile
impl Sync for HashLineFile
impl Unpin for HashLineFile
impl UnsafeUnpin for HashLineFile
impl UnwindSafe for HashLineFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more