pub struct Database<C> { /* private fields */ }Implementations§
Source§impl<C> Database<C>
impl<C> Database<C>
Sourcepub fn open(cache: C) -> Result<Self, Error>
pub fn open(cache: C) -> Result<Self, Error>
Open the given MIME-info cache
This can be an in-memory buffer or a memory map of a mime.cache file.
use std::fs::File;
use memmap2::Mmap;
use tiny_tree_magic::Database;
let cache = unsafe { Mmap::map(&File::open("/usr/share/mime/mime.cache")?)? };
let database = Database::open(cache)?;pub fn match<'a>(&'a self, bytes: &[u8]) -> Result<&'a str, Error>
Auto Trait Implementations§
impl<C> Freeze for Database<C>where
C: Freeze,
impl<C> RefUnwindSafe for Database<C>where
C: RefUnwindSafe,
impl<C> Send for Database<C>where
C: Send,
impl<C> Sync for Database<C>where
C: Sync,
impl<C> Unpin for Database<C>where
C: Unpin,
impl<C> UnsafeUnpin for Database<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for Database<C>where
C: 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