pub struct TagSet { /* private fields */ }Expand description
A compact set of file tags represented as a fixed-size bitset.
Each bit corresponds to an index in tags::ALL_TAGS.
This keeps membership / set operations fast and allocation-free.
Implementations§
Source§impl TagSet
impl TagSet
Sourcepub const fn new(tag_ids: &[u16]) -> Self
pub const fn new(tag_ids: &[u16]) -> Self
Constructs a TagSet from tag ids.
tag_ids must reference valid indexes in [tags::ALL_TAGS_BY_ID].
Duplicate ids are allowed and are automatically coalesced.
Constructs a TagSet from tag strings.
Unknown tags are ignored in release builds and debug-asserted in debug builds.
pub const fn insert(&mut self, tag_id: u16)
Sourcepub fn is_disjoint(&self, other: &TagSet) -> bool
pub fn is_disjoint(&self, other: &TagSet) -> bool
Returns true if the two sets do not share any tag.
Sourcepub fn is_subset(&self, other: &TagSet) -> bool
pub fn is_subset(&self, other: &TagSet) -> bool
Returns true if all tags in self are also present in other.
Sourcepub fn iter(&self) -> TagSetIter<'_> ⓘ
pub fn iter(&self) -> TagSetIter<'_> ⓘ
Iterates tags in deterministic id order.
Trait Implementations§
Source§impl BitOrAssign<&TagSet> for TagSet
impl BitOrAssign<&TagSet> for TagSet
Source§fn bitor_assign(&mut self, rhs: &TagSet)
fn bitor_assign(&mut self, rhs: &TagSet)
Performs the
|= operation. Read moreimpl Copy for TagSet
Auto Trait Implementations§
impl Freeze for TagSet
impl RefUnwindSafe for TagSet
impl Send for TagSet
impl Sync for TagSet
impl Unpin for TagSet
impl UnsafeUnpin for TagSet
impl UnwindSafe for TagSet
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