pub struct ReadDatabase { /* private fields */ }Expand description
Immutable, read-optimized snapshot of the database.
Implementations§
Source§impl ReadDatabase
impl ReadDatabase
pub fn empty() -> Self
Sourcepub fn single(file: File) -> Self
pub fn single(file: File) -> Self
Creates a new ReadDatabase containing only a single file.
This is a convenience constructor for situations, such as testing or
single-file tools, where an operation requires a DatabaseReader
implementation but only needs to be aware of one file.
§Arguments
file: The singleFileto include in the database.
Trait Implementations§
Source§impl DatabaseReader for ReadDatabase
impl DatabaseReader for ReadDatabase
Source§fn get_id(&self, name: &[u8]) -> Option<FileId>
fn get_id(&self, name: &[u8]) -> Option<FileId>
Retrieves a file’s stable ID using its logical name.
Source§fn get(&self, id: &FileId) -> Result<Arc<File>, DatabaseError>
fn get(&self, id: &FileId) -> Result<Arc<File>, DatabaseError>
Retrieves a reference to a file using its stable
FileId. Read moreSource§fn get_ref(&self, id: &FileId) -> Result<&File, DatabaseError>
fn get_ref(&self, id: &FileId) -> Result<&File, DatabaseError>
Retrieves a reference to a file using its stable
FileId. Read moreSource§fn get_by_name(&self, name: &[u8]) -> Result<Arc<File>, DatabaseError>
fn get_by_name(&self, name: &[u8]) -> Result<Arc<File>, DatabaseError>
Retrieves a reference to a file using its logical name. Read more
Source§fn get_by_path(&self, path: &Path) -> Result<Arc<File>, DatabaseError>
fn get_by_path(&self, path: &Path) -> Result<Arc<File>, DatabaseError>
Retrieves a reference to a file by its absolute filesystem path. Read more
Source§fn files(&self) -> impl Iterator<Item = Arc<File>>
fn files(&self) -> impl Iterator<Item = Arc<File>>
Returns an iterator over all files in the database. Read more
Source§fn files_with_type(
&self,
file_type: FileType,
) -> impl Iterator<Item = Arc<File>>
fn files_with_type( &self, file_type: FileType, ) -> impl Iterator<Item = Arc<File>>
Returns an iterator over all files of a specific
FileType.Source§fn files_without_type(
&self,
file_type: FileType,
) -> impl Iterator<Item = Arc<File>>
fn files_without_type( &self, file_type: FileType, ) -> impl Iterator<Item = Arc<File>>
Returns an iterator over all files that do not match a specific
FileType.Source§fn file_ids(&self) -> impl Iterator<Item = FileId>
fn file_ids(&self) -> impl Iterator<Item = FileId>
Returns an iterator over the stable IDs of all files in the database.
Source§fn file_ids_with_type(
&self,
file_type: FileType,
) -> impl Iterator<Item = FileId>
fn file_ids_with_type( &self, file_type: FileType, ) -> impl Iterator<Item = FileId>
Returns an iterator over the stable IDs of all files of a specific
FileType.Auto Trait Implementations§
impl !Freeze for ReadDatabase
impl Forget for ReadDatabase
impl Move for ReadDatabase
impl RefUnwindSafe for ReadDatabasewhere
Atomic<usize>: RefUnwindSafe,
Vec<u8>: RefUnwindSafe,
OnceLock<HashMap<Cow<'static, [u8]>, usize, RandomState>>: RefUnwindSafe,
OnceLock<HashMap<PathBuf, usize, RandomState>>: RefUnwindSafe,
impl Send for ReadDatabase
impl Sync for ReadDatabase
impl Unpin for ReadDatabase
impl UnsafeUnpin for ReadDatabasewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Arc<File>>: UnsafeUnpin,
PhantomData<(FileId, usize)>: UnsafeUnpin,
Align4<u32>: UnsafeUnpin,
PhantomData<(Cow<'static, [u8]>, usize)>: UnsafeUnpin,
PhantomData<HashMap<Cow<'static, [u8]>, usize, RandomState>>: UnsafeUnpin,
PhantomData<(PathBuf, usize)>: UnsafeUnpin,
PhantomData<HashMap<PathBuf, usize, RandomState>>: UnsafeUnpin,
impl UnwindSafe for ReadDatabasewhere
RawVecInner: UnwindSafe,
Arc<File>: UnwindSafe,
HashMap<FileId, usize, RandomState>: UnwindSafe,
OnceLock<HashMap<Cow<'static, [u8]>, usize, RandomState>>: UnwindSafe,
OnceLock<HashMap<PathBuf, usize, RandomState>>: UnwindSafe,
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> 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