pub struct FileData {
pub absolute_path: PathBuf,
pub relative_path: String,
pub content: FileContent,
pub token_count: usize,
}Expand description
Represents a file with its content and metadata.
Fields§
§absolute_path: PathBufAbsolute path to the file
relative_path: StringRelative path from the root directory
content: FileContentFile content (text or binary)
token_count: usizeEstimated token count
Implementations§
Source§impl FileData
impl FileData
Sourcepub fn new_text(
absolute_path: PathBuf,
relative_path: String,
content: String,
token_count: usize,
) -> Self
pub fn new_text( absolute_path: PathBuf, relative_path: String, content: String, token_count: usize, ) -> Self
Creates a new text file data.
Sourcepub fn new_binary(
absolute_path: PathBuf,
relative_path: String,
size: u64,
) -> Self
pub fn new_binary( absolute_path: PathBuf, relative_path: String, size: u64, ) -> Self
Creates a new binary file data.
Sourcepub fn content_str(&self) -> Option<&str>
pub fn content_str(&self) -> Option<&str>
Returns the text content if this is a text file.
Sourcepub fn size_bytes(&self) -> u64
pub fn size_bytes(&self) -> u64
Returns the size in bytes.
Sourcepub fn line_count(&self) -> Option<usize>
pub fn line_count(&self) -> Option<usize>
Returns the number of lines (for text files only).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileData
impl RefUnwindSafe for FileData
impl Send for FileData
impl Sync for FileData
impl Unpin for FileData
impl UnwindSafe for FileData
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)