pub struct TagSet(/* private fields */);
Expand description
A set of tags.
Implementations§
Source§impl TagSet
impl TagSet
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new, empty tag set with the given capacity.
Sourcepub fn insert_tag<T>(&mut self, tag: T)
pub fn insert_tag<T>(&mut self, tag: T)
Inserts a tag into the set.
If the tag is already present in the set, this does nothing.
Removes a tag, by name, from the set.
Sourcepub fn has_tag<T>(&self, tag: T) -> bool
pub fn has_tag<T>(&self, tag: T) -> bool
Returns true
if the given tag is contained in the set.
This matches the complete tag, rather than just the name.
Sourcepub fn get_single_tag<T>(&self, tag_name: T) -> Option<&Tag>
pub fn get_single_tag<T>(&self, tag_name: T) -> Option<&Tag>
Gets a single tag, by name, from the set.
If multiple tags are present with the same name, the first tag with a matching name will be returned. If no tag
in the set matches, None
is returned.
Sourcepub fn retain<F>(&mut self, f: F)
pub fn retain<F>(&mut self, f: F)
Retains only the tags specified by the predicate.
In other words, remove all tags t
for which f(&t)
returns false
. This method operates in place, visiting
each element exactly once in the original order, and preserves the order of the retained tags.
Sourcepub fn merge_missing(&mut self, other: Self)
pub fn merge_missing(&mut self, other: Self)
Merges the tags from another set into this set.
If a tag from other
is already present in this set, it will not be added.
Merges the tags from another shared set into this set.
If a tag from other
is already present in this set, it will not be added.
Consumes this TagSet
and returns a shared, read-only version of it.
Trait Implementations§
Source§impl Extend<Tag> for TagSet
impl Extend<Tag> for TagSet
Source§fn extend<T: IntoIterator<Item = Tag>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Tag>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl FromIterator<Tag> for TagSet
impl FromIterator<Tag> for TagSet
Source§impl<'a> IntoIterator for &'a TagSet
impl<'a> IntoIterator for &'a TagSet
Source§impl IntoIterator for TagSet
impl IntoIterator 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
§impl<T> Track for T
impl<T> Track for T
§fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
Tracked
wrapper. Read more§fn in_current_allocation_group(self) -> Tracked<Self>
fn in_current_allocation_group(self) -> Tracked<Self>
Tracked
wrapper. Read more