pub struct PackagesDb { /* private fields */ }Expand description
Handle to an open spam packages database or autonomous index.
Only the fixed-size bucket index is loaded into memory on construction.
Implementations§
Source§impl PackagesDb
impl PackagesDb
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Open the packages database or autonomous index at path.
Returns Error::InvalidDatabase if the file is not queryable by spam pkg.
Sourcepub fn query(&self, query: &str) -> Result<Vec<FileRecord>>
pub fn query(&self, query: &str) -> Result<Vec<FileRecord>>
Return all records whose path contains query as a substring.
Decompresses only the bucket for query[0]. An empty query reads bucket 0.
Both the legacy format (path\tpkg1,pkg2,...) and the extended format
(path\tkind\tsize\texec\ttarget\tpkg1,pkg2,...) are supported.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PackagesDb
impl RefUnwindSafe for PackagesDb
impl Send for PackagesDb
impl Sync for PackagesDb
impl Unpin for PackagesDb
impl UnsafeUnpin for PackagesDb
impl UnwindSafe for PackagesDb
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