pub struct FileInfo {
pub lines: Vec<String>,
pub total_lines: usize,
pub total_lines_exact: bool,
pub total_bytes: usize,
pub truncated: bool,
pub truncated_by_lines: bool,
pub truncated_by_bytes: bool,
pub language: Option<String>,
pub encoding: String,
pub syntax_errors: Vec<String>,
pub compression_ratio: Option<f64>,
}Expand description
Information about a processed file
Fields§
§lines: Vec<String>The processed lines of the file
total_lines: usizeTotal number of lines in the original file
total_lines_exact: boolWhether total_lines reflects the entire file
total_bytes: usizeTotal number of bytes in the original file
truncated: boolWhether the file was truncated during processing
truncated_by_lines: boolWhether truncation was due to line limit
truncated_by_bytes: boolWhether truncation was due to byte limit
language: Option<String>Detected or specified language
encoding: StringDetected encoding of the file
syntax_errors: Vec<String>Syntax errors encountered during processing
compression_ratio: Option<f64>Ratio of original line count to stripped line count (set when strip_comments or strip_blank_lines is active)
Implementations§
Source§impl FileInfo
impl FileInfo
Sourcepub const fn with_metadata(
total_lines: usize,
total_bytes: usize,
language: Option<String>,
encoding: String,
) -> Self
pub const fn with_metadata( total_lines: usize, total_bytes: usize, language: Option<String>, encoding: String, ) -> Self
Create a FileInfo with basic metadata
Sourcepub fn with_lines(self, lines: Vec<String>) -> Self
pub fn with_lines(self, lines: Vec<String>) -> Self
Set the processed lines
Sourcepub const fn with_truncation(
self,
truncated: bool,
by_lines: bool,
by_bytes: bool,
) -> Self
pub const fn with_truncation( self, truncated: bool, by_lines: bool, by_bytes: bool, ) -> Self
Set truncation information
Sourcepub fn add_syntax_error(&mut self, error: String)
pub fn add_syntax_error(&mut self, error: String)
Add a syntax error
Sourcepub const fn with_compression_ratio(self, ratio: Option<f64>) -> Self
pub const fn with_compression_ratio(self, ratio: Option<f64>) -> Self
Set compression ratio (original lines / stripped lines)
Sourcepub const fn with_total_lines_exact(self, exact: bool) -> Self
pub const fn with_total_lines_exact(self, exact: bool) -> Self
Mark whether total_lines is exact
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if the file was processed successfully
Sourcepub fn processed_lines(&self) -> usize
pub fn processed_lines(&self) -> usize
Get the number of processed lines
Sourcepub fn processing_ratio(&self) -> f64
pub fn processing_ratio(&self) -> f64
Get the processing ratio (processed lines / total lines)
Sourcepub fn truncation_reason(&self) -> Option<String>
pub fn truncation_reason(&self) -> Option<String>
Get truncation reason as a human-readable string
Sourcepub fn get_stats_summary(&self) -> ProcessingStats
pub fn get_stats_summary(&self) -> ProcessingStats
Get a summary of processing statistics