pub struct CfgSet(/* private fields */);
Expand description

Set of #[cfg(...)] options.

Behaves like a multimap, i.e. it permits storing multiple values for the same key. This allows expressing, for example, the feature option that Rust/Cargo does.

Implementations§

source§

impl CfgSet

source

pub fn new() -> Self

Creates an empty CfgSet.

This function does not allocate.

source

pub fn len(&self) -> usize

Returns the number of elements in the set.

source

pub fn is_empty(&self) -> bool

Returns true if the set contains no elements.

source

pub fn insert(&mut self, cfg: Cfg)

Adds a value to the set.

source

pub fn union(&self, other: &Self) -> Self

Combines two sets into new one.

source

pub fn iter(&self) -> impl Iterator<Item = &Cfg>

An iterator visiting all elements in insertion order.

source

pub fn contains(&self, cfg: &Cfg) -> bool

Returns true if the set contains a value.

source

pub fn is_subset(&self, other: &Self) -> bool

Returns true if the set is a subset of another, i.e., other contains at least all the values in self.

source

pub fn is_superset(&self, other: &Self) -> bool

Returns true if the set is a superset of another, i.e., self contains at least all the values in other.

Trait Implementations§

source§

impl Clone for CfgSet

source§

fn clone(&self) -> CfgSet

Returns a copy 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 CfgSet

source§

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

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

impl Default for CfgSet

source§

fn default() -> CfgSet

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

impl<'de> Deserialize<'de> for CfgSet

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl FromIterator<Cfg> for CfgSet

source§

fn from_iter<T: IntoIterator<Item = Cfg>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<'a> IntoIterator for &'a CfgSet

§

type Item = &'a Cfg

The type of the elements being iterated over.
§

type IntoIter = <&'a OrderedHashSet<Cfg> as IntoIterator>::IntoIter

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 CfgSet

§

type Item = Cfg

The type of the elements being iterated over.
§

type IntoIter = <OrderedHashSet<Cfg> as IntoIterator>::IntoIter

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 for CfgSet

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for CfgSet

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
source§

impl Eq for CfgSet

source§

impl StructuralEq for CfgSet

source§

impl StructuralPartialEq for CfgSet

Auto Trait Implementations§

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> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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> Upcast<T> for T
where T: ?Sized,

source§

fn upcast(&self) -> &T

source§

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

source§

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

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,