pub struct FileInfo {Show 19 fields
pub lines: Vec<String>,
pub original_lines: Option<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 truncated_by_context: bool,
pub language: Option<String>,
pub encoding: String,
pub syntax_errors: Vec<String>,
pub tokens: Option<Vec<String>>,
pub token_total: Option<usize>,
pub summary_lines: Option<Vec<SummaryItem>>,
pub file_hash: Option<String>,
pub estimated_llm_tokens: Option<u64>,
pub token_model: Option<String>,
pub compression_ratio: Option<f64>,
}Expand description
Information about a processed file
Fields§
§lines: Vec<String>The processed lines of the file
original_lines: Option<Vec<String>>Original lines before any summary transformations
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
truncated_by_context: boolWhether truncation was due to context fitting
language: Option<String>Detected or specified language
encoding: StringDetected encoding of the file
syntax_errors: Vec<String>Syntax errors encountered during processing
tokens: Option<Vec<String>>Extracted tokens (if requested)
token_total: Option<usize>Total number of tokens extracted (including truncated samples)
summary_lines: Option<Vec<SummaryItem>>Summary items with line numbers (if in summary mode)
file_hash: Option<String>SHA-256 hex digest of file content (only populated when –hash is passed)
estimated_llm_tokens: Option<u64>Estimated LLM token count for the output content (heuristic)
token_model: Option<String>AI model used for token estimation (e.g. “Claude”, “Gpt4”)
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 fn with_metadata(
total_lines: usize,
total_bytes: usize,
language: Option<String>,
encoding: String,
) -> Self
pub 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 fn with_truncation(
self,
truncated: bool,
by_lines: bool,
by_bytes: bool,
) -> Self
pub fn with_truncation( self, truncated: bool, by_lines: bool, by_bytes: bool, ) -> Self
Set truncation information
Sourcepub fn with_context_truncation(self, truncated: bool) -> Self
pub fn with_context_truncation(self, truncated: bool) -> Self
Set context-based truncation
Sourcepub fn add_syntax_error(&mut self, error: String)
pub fn add_syntax_error(&mut self, error: String)
Add a syntax error
Sourcepub fn with_tokens(self, tokens: Option<Vec<String>>) -> Self
pub fn with_tokens(self, tokens: Option<Vec<String>>) -> Self
Set tokens
Sourcepub fn with_token_total(self, total: Option<usize>) -> Self
pub fn with_token_total(self, total: Option<usize>) -> Self
Store the total number of tokens identified
Sourcepub fn with_file_hash(self, hash: Option<String>) -> Self
pub fn with_file_hash(self, hash: Option<String>) -> Self
Set file hash
Sourcepub fn with_estimated_llm_tokens(
self,
tokens: Option<u64>,
model: Option<String>,
) -> Self
pub fn with_estimated_llm_tokens( self, tokens: Option<u64>, model: Option<String>, ) -> Self
Set estimated LLM token count and the model used for estimation
Sourcepub fn with_compression_ratio(self, ratio: Option<f64>) -> Self
pub fn with_compression_ratio(self, ratio: Option<f64>) -> Self
Set compression ratio (original lines / stripped lines)
Sourcepub fn with_summary_lines(self, summary_lines: Option<Vec<SummaryItem>>) -> Self
pub fn with_summary_lines(self, summary_lines: Option<Vec<SummaryItem>>) -> Self
Set summary items
Sourcepub fn with_original_lines(self, original: Option<Vec<String>>) -> Self
pub fn with_original_lines(self, original: Option<Vec<String>>) -> Self
Preserve original lines before summary transformations
Sourcepub fn with_total_lines_exact(self, exact: bool) -> Self
pub 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 has_tokens(&self) -> bool
pub fn has_tokens(&self) -> bool
Check if any tokens were extracted
Sourcepub fn has_summary(&self) -> bool
pub fn has_summary(&self) -> bool
Check if summary was generated
Sourcepub fn token_count(&self) -> usize
pub fn token_count(&self) -> usize
Get the number of tokens (if any)
Sourcepub fn tokens_truncated(&self) -> bool
pub fn tokens_truncated(&self) -> bool
Check if the displayed token list was truncated
Sourcepub fn summary_line_count(&self) -> usize
pub fn summary_line_count(&self) -> usize
Get the number of summary lines (if any)
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