pub struct TagTable { /* private fields */ }Expand description
One of identify’s lookup tables (EXTENSIONS,
NAMES, …): a static map from &str keys to
TagSets.
Lookups hash the key once and never allocate. Iteration yields entries sorted by key.
Implementations§
Source§impl TagTable
impl TagTable
Sourcepub fn get(&self, key: &str) -> Option<TagSet>
pub fn get(&self, key: &str) -> Option<TagSet>
The tags stored for key (exact, case-sensitive match).
Sourcepub fn get_bytes(&self, key: &[u8]) -> Option<TagSet>
pub fn get_bytes(&self, key: &[u8]) -> Option<TagSet>
Like get for a key given as bytes (e.g. a
non-UTF-8 file name, which never matches).
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Whether key is in the table.
Sourcepub const fn entries(&self) -> &'static [(&'static str, TagSet)]
pub const fn entries(&self) -> &'static [(&'static str, TagSet)]
All (key, tags) entries, sorted by key.
Sourcepub fn iter(
&self,
) -> impl DoubleEndedIterator<Item = (&'static str, TagSet)> + ExactSizeIterator + FusedIterator
pub fn iter( &self, ) -> impl DoubleEndedIterator<Item = (&'static str, TagSet)> + ExactSizeIterator + FusedIterator
Iterate over (key, tags) entries sorted by key.
Sourcepub fn keys(
&self,
) -> impl DoubleEndedIterator<Item = &'static str> + ExactSizeIterator + FusedIterator
pub fn keys( &self, ) -> impl DoubleEndedIterator<Item = &'static str> + ExactSizeIterator + FusedIterator
Iterate over the keys in sorted order.
Sourcepub fn values(
&self,
) -> impl DoubleEndedIterator<Item = TagSet> + ExactSizeIterator + FusedIterator
pub fn values( &self, ) -> impl DoubleEndedIterator<Item = TagSet> + ExactSizeIterator + FusedIterator
Iterate over the tag sets in key order.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TagTable
impl RefUnwindSafe for TagTable
impl Send for TagTable
impl Sync for TagTable
impl Unpin for TagTable
impl UnsafeUnpin for TagTable
impl UnwindSafe for TagTable
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