pub struct FileRegistry { /* private fields */ }Expand description
Implementations§
Source§impl FileRegistry
impl FileRegistry
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a registry with pre-allocated capacity.
Sourcepub fn register(&mut self, path: WorkspaceFilePath) -> FileId
pub fn register(&mut self, path: WorkspaceFilePath) -> FileId
Register a file (returns existing ID if already registered).
§Returns
FileId: Registration success (new or existing)
Sourcepub fn remove(&mut self, id: FileId) -> Option<WorkspaceFilePath>
pub fn remove(&mut self, id: FileId) -> Option<WorkspaceFilePath>
Remove a file from the registry.
§Returns
Some(WorkspaceFilePath): The removed file’s pathNone: File not found
Sourcepub fn lookup(&self, path: &WorkspaceFilePath) -> Option<FileId>
pub fn lookup(&self, path: &WorkspaceFilePath) -> Option<FileId>
WorkspaceFilePath → FileId (O(1) hash lookup).
Sourcepub fn path(&self, id: FileId) -> Option<&WorkspaceFilePath>
pub fn path(&self, id: FileId) -> Option<&WorkspaceFilePath>
FileId → WorkspaceFilePath (O(1) array access).
Sourcepub fn crate_name(&self, id: FileId) -> Option<&str>
pub fn crate_name(&self, id: FileId) -> Option<&str>
FileId → crate name (convenience method).
Sourcepub fn contains(&self, id: FileId) -> bool
pub fn contains(&self, id: FileId) -> bool
Check if FileId is valid (including generation check).
Sourcepub fn update_path(
&mut self,
id: FileId,
new_path: WorkspaceFilePath,
) -> Result<WorkspaceFilePath, InvalidFileId>
pub fn update_path( &mut self, id: FileId, new_path: WorkspaceFilePath, ) -> Result<WorkspaceFilePath, InvalidFileId>
Update file path (e.g., after rename/move).
This updates the path while preserving the FileId.
Sourcepub fn iter(&self) -> impl Iterator<Item = (FileId, &WorkspaceFilePath)>
pub fn iter(&self) -> impl Iterator<Item = (FileId, &WorkspaceFilePath)>
Iterate over all files.
Sourcepub fn iter_in_crate<'a>(
&'a self,
crate_name: &'a str,
) -> impl Iterator<Item = FileId> + 'a
pub fn iter_in_crate<'a>( &'a self, crate_name: &'a str, ) -> impl Iterator<Item = FileId> + 'a
Iterate over files in a specific crate.
Trait Implementations§
Source§impl Clone for FileRegistry
impl Clone for FileRegistry
Source§fn clone(&self) -> FileRegistry
fn clone(&self) -> FileRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for FileRegistry
impl Default for FileRegistry
Auto Trait Implementations§
impl Freeze for FileRegistry
impl RefUnwindSafe for FileRegistry
impl Send for FileRegistry
impl Sync for FileRegistry
impl Unpin for FileRegistry
impl UnsafeUnpin for FileRegistry
impl UnwindSafe for FileRegistry
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> 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