pub struct Codebook { /* private fields */ }Implementations§
Source§impl Codebook
impl Codebook
pub fn new() -> Self
Sourcepub fn build_from_files(&mut self, files: &[(&str, &str)])
pub fn build_from_files(&mut self, files: &[(&str, &str)])
Build codebook from multiple file contents (borrows, no cloning). Identifies lines that appear in 3+ files and creates short references. Skips codebook phase entirely if total line count exceeds 50,000 to prevent memory spikes on large projects.
Sourcepub fn compress(&self, content: &str) -> (String, Vec<String>)
pub fn compress(&self, content: &str) -> (String, Vec<String>)
Apply codebook to content: replace known patterns with short references. Returns (compressed content, references used).
Sourcepub fn format_legend(&self, refs_used: &[String]) -> String
pub fn format_legend(&self, refs_used: &[String]) -> String
Format the codebook legend for lines that were referenced.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Forget for Codebook
impl Freeze for Codebookwhere
*const u8 is !null: Freeze,
PhantomData<CodebookEntry>: Freeze,
PhantomData<(String, String)>: Freeze,
impl Move for Codebook
impl RefUnwindSafe for Codebook
impl Send for Codebook
impl Sync for Codebook
impl Unpin for Codebook
impl UnsafeUnpin for Codebookwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<CodebookEntry>: UnsafeUnpin,
PhantomData<(String, String)>: UnsafeUnpin,
impl UnwindSafe for Codebook
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more