pub struct FileItem {
pub size: u64,
pub modified: u64,
pub access_frecency_score: i16,
pub modification_frecency_score: i16,
pub git_status: Option<Status>,
/* private fields */
}Fields§
§size: u64§modified: u64§access_frecency_score: i16§modification_frecency_score: i16§git_status: Option<Status>Implementations§
Source§impl FileItem
impl FileItem
pub fn new( path: PathBuf, base_path: &Path, git_status: Option<Status>, ) -> (Self, String)
Sourcepub fn new_from_walk(
path: &Path,
base_path: &Path,
git_status: Option<Status>,
metadata: Option<&Metadata>,
) -> (Self, String)
pub fn new_from_walk( path: &Path, base_path: &Path, git_status: Option<Status>, metadata: Option<&Metadata>, ) -> (Self, String)
Create a FileItem with an empty ChunkedString from a path on disk.
Returns (file_item, relative_path_string). The relative path must be
kept alongside the FileItem until build_chunked_path_store_and_assign
populates each item’s path field from the shared arena.
Source§impl FileItem
impl FileItem
pub fn new_raw( filename_start: u16, size: u64, modified: u64, git_status: Option<Status>, is_binary: bool, ) -> Self
Sourcepub fn absolute_path(
&self,
arena: impl FFFStringStorage,
base_path: &Path,
) -> PathBuf
pub fn absolute_path( &self, arena: impl FFFStringStorage, base_path: &Path, ) -> PathBuf
Returns an absolute path of the file
pub fn dir_str(&self, arena: impl FFFStringStorage) -> String
pub fn file_name(&self, arena: impl FFFStringStorage) -> String
pub fn relative_path(&self, arena: impl FFFStringStorage) -> String
pub fn relative_path_len(&self) -> usize
pub fn filename_offset_in_relative_path(&self) -> usize
pub fn total_frecency_score(&self) -> i32
pub fn is_binary(&self) -> bool
pub fn set_binary(&mut self, val: bool)
pub fn is_deleted(&self) -> bool
pub fn set_deleted(&mut self, val: bool)
pub fn is_overflow(&self) -> bool
pub fn set_overflow(&mut self, val: bool)
Source§impl FileItem
impl FileItem
Sourcepub fn invalidate_mmap(&mut self, budget: &ContentCacheBudget)
pub fn invalidate_mmap(&mut self, budget: &ContentCacheBudget)
Invalidate the cached content so the next get_content() call creates a fresh one.
Call this when the background watcher detects that the file has been modified. On Unix, a file that is truncated while mapped can cause SIGBUS. On Windows, the stale buffer simply won’t reflect the new contents. In both cases, invalidating ensures a fresh read on the next access.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for FileItem
impl RefUnwindSafe for FileItem
impl Send for FileItem
impl Sync for FileItem
impl Unpin for FileItem
impl UnsafeUnpin for FileItem
impl UnwindSafe for FileItem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more