TagSet

Struct TagSet 

Source
pub struct TagSet(/* private fields */);
Expand description

A set of tags.

Implementations§

Source§

impl TagSet

Source

pub fn with_capacity(capacity: usize) -> Self

Creates a new, empty tag set with the given capacity.

Source

pub fn is_empty(&self) -> bool

Returns true if the tag set is empty.

Source

pub fn len(&self) -> usize

Returns the number of tags in the set.

Source

pub fn insert_tag<T>(&mut self, tag: T)
where T: Into<Tag>,

Inserts a tag into the set.

If the tag is already present in the set, this does nothing.

Source

pub fn remove_tags<T>(&mut self, tag_name: T) -> Option<Vec<Tag>>
where T: AsRef<str>,

Removes a tag, by name, from the set.

Source

pub fn has_tag<T>(&self, tag: T) -> bool
where T: AsRef<str>,

Returns true if the given tag is contained in the set.

This matches the complete tag, rather than just the name.

Source

pub fn get_single_tag<T>(&self, tag_name: T) -> Option<&Tag>
where T: AsRef<str>,

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.

Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&Tag) -> bool,

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.

Source

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.

Source

pub fn merge_missing_shared(&mut self, other: &SharedTagSet)

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.

Source

pub fn into_shared(self) -> SharedTagSet

Consumes this TagSet and returns a shared, read-only version of it.

Trait Implementations§

Source§

impl Clone for TagSet

Source§

fn clone(&self) -> TagSet

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TagSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TagSet

Source§

fn default() -> TagSet

Returns the “default value” for a type. Read more
Source§

impl Display for TagSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Extend<Tag> for TagSet

Source§

fn extend<T: IntoIterator<Item = Tag>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<Tag> for TagSet

Source§

fn from(tag: Tag) -> Self

Converts to this type from the input type.
Source§

impl From<TagSet> for SharedTagSet

Source§

fn from(tag_set: TagSet) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Tag> for TagSet

Source§

fn from_iter<I: IntoIterator<Item = Tag>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a> IntoIterator for &'a TagSet

Source§

type Item = &'a Tag

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Tag>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for TagSet

Source§

type Item = Tag

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Tag>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq<TagSet> for SharedTagSet

Source§

fn eq(&self, other: &TagSet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for TagSet

Source§

fn eq(&self, other: &TagSet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TagSet

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Stringable for T
where T: Display,

§

fn to_shared_string(&self) -> Cow<'static, str>

Converts the given value to a SharedString.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> Track for T

§

fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>

Instruments this type by attaching the given allocation group token, returning a Tracked wrapper. Read more
§

fn in_current_allocation_group(self) -> Tracked<Self>

Instruments this type by attaching the current allocation group, returning a Tracked wrapper. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more