Skip to main content

FileInfo

Struct FileInfo 

Source
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: usize

Total number of lines in the original file

§total_lines_exact: bool

Whether total_lines reflects the entire file

§total_bytes: usize

Total number of bytes in the original file

§truncated: bool

Whether the file was truncated during processing

§truncated_by_lines: bool

Whether truncation was due to line limit

§truncated_by_bytes: bool

Whether truncation was due to byte limit

§truncated_by_context: bool

Whether truncation was due to context fitting

§language: Option<String>

Detected or specified language

§encoding: String

Detected 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

Source

pub fn new() -> Self

Create a new FileInfo instance

Source

pub fn with_metadata( total_lines: usize, total_bytes: usize, language: Option<String>, encoding: String, ) -> Self

Create a FileInfo with basic metadata

Source

pub fn with_lines(self, lines: Vec<String>) -> Self

Set the processed lines

Source

pub fn with_truncation( self, truncated: bool, by_lines: bool, by_bytes: bool, ) -> Self

Set truncation information

Source

pub fn with_context_truncation(self, truncated: bool) -> Self

Set context-based truncation

Source

pub fn add_syntax_error(&mut self, error: String)

Add a syntax error

Source

pub fn with_tokens(self, tokens: Option<Vec<String>>) -> Self

Set tokens

Source

pub fn with_token_total(self, total: Option<usize>) -> Self

Store the total number of tokens identified

Source

pub fn with_file_hash(self, hash: Option<String>) -> Self

Set file hash

Source

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

Source

pub fn with_compression_ratio(self, ratio: Option<f64>) -> Self

Set compression ratio (original lines / stripped lines)

Source

pub fn with_summary_lines(self, summary_lines: Option<Vec<SummaryItem>>) -> Self

Set summary items

Source

pub fn with_original_lines(self, original: Option<Vec<String>>) -> Self

Preserve original lines before summary transformations

Source

pub fn with_total_lines_exact(self, exact: bool) -> Self

Mark whether total_lines is exact

Source

pub fn is_success(&self) -> bool

Check if the file was processed successfully

Source

pub fn processed_lines(&self) -> usize

Get the number of processed lines

Source

pub fn processing_ratio(&self) -> f64

Get the processing ratio (processed lines / total lines)

Source

pub fn has_tokens(&self) -> bool

Check if any tokens were extracted

Source

pub fn has_summary(&self) -> bool

Check if summary was generated

Source

pub fn token_count(&self) -> usize

Get the number of tokens (if any)

Source

pub fn tokens_truncated(&self) -> bool

Check if the displayed token list was truncated

Source

pub fn summary_line_count(&self) -> usize

Get the number of summary lines (if any)

Source

pub fn truncation_reason(&self) -> Option<String>

Get truncation reason as a human-readable string

Source

pub fn get_stats_summary(&self) -> ProcessingStats

Get a summary of processing statistics

Trait Implementations§

Source§

impl Clone for FileInfo

Source§

fn clone(&self) -> FileInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FileInfo

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for FileInfo

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for FileInfo

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,