FileInfo

Struct FileInfo 

Source
pub struct FileInfo {
Show 14 fields pub path: PathBuf, pub relative_path: String, pub size: u64, pub modified: Option<SystemTime>, pub decision: RenderDecision, pub file_type: FileType, pub language: Language, pub content: Option<String>, pub token_estimate: Option<usize>, pub line_count: Option<usize>, pub char_count: Option<usize>, pub is_binary: bool, pub git_status: Option<GitStatus>, pub centrality_score: Option<f64>,
}
Expand description

Comprehensive file metadata structure

Fields§

§path: PathBuf

Absolute path to the file on disk

§relative_path: String

Path relative to repository root (forward slash separated)

§size: u64

File size in bytes

§modified: Option<SystemTime>

File modification time

§decision: RenderDecision

Analysis decision (include/exclude)

§file_type: FileType

Detected file type

§language: Language

Detected programming language

§content: Option<String>

File content (loaded on demand)

§token_estimate: Option<usize>

Estimated token count for LLM processing

§line_count: Option<usize>

Line count (if text file)

§char_count: Option<usize>

Character count (if text file)

§is_binary: bool

Whether the file is likely binary

§git_status: Option<GitStatus>

Git status information (if available)

§centrality_score: Option<f64>

PageRank centrality score (0.0-1.0, higher means more important)

Implementations§

Source§

impl FileInfo

Source

pub fn new<P: AsRef<Path>>( path: P, relative_path: String, decision: RenderDecision, ) -> Result<Self>

Create a new FileInfo from a path

Source

pub fn load_content(&mut self) -> Result<()>

Load file content and compute statistics

Source

pub fn estimate_tokens(content: &str) -> usize

Estimate token count for LLM processing using tiktoken

This method uses the shared global TokenCounter instance for optimal performance. If tiktoken fails, it falls back to the legacy character-based estimation.

Source

pub fn estimate_tokens_with_path(content: &str, file_path: &Path) -> usize

Estimate token count for LLM processing with file context

This method uses the file path to apply language-specific multipliers for more accurate token estimation.

Source

pub fn detect_binary_by_extension(extension: &str) -> bool

Check if file extension indicates binary content

Source

pub fn classify_file_type( path: &str, language: &Language, extension: &str, ) -> FileType

Classify file type based on path and language

Source

pub fn human_size(&self) -> String

Get human-readable size

Source

pub fn should_include(&self) -> bool

Check if file should be included in analysis

Source

pub fn file_name(&self) -> Option<&str>

Get file name (last component of path)

Source

pub fn file_stem(&self) -> Option<&str>

Get file stem (name without extension)

Source

pub fn extension(&self) -> Option<&str>

Get file extension

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<'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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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>,