pub struct CapabilitySet { /* private fields */ }Expand description
A set of capabilities supported by a device or protocol.
Implementations§
Source§impl CapabilitySet
impl CapabilitySet
Sourcepub fn new() -> CapabilitySet
pub fn new() -> CapabilitySet
Create an empty capability set.
Sourcepub fn with_capabilities(
caps: impl IntoIterator<Item = Capability>,
) -> CapabilitySet
pub fn with_capabilities( caps: impl IntoIterator<Item = Capability>, ) -> CapabilitySet
Create a capability set with the given capabilities.
Sourcepub fn add(&mut self, cap: Capability)
pub fn add(&mut self, cap: Capability)
Add a capability.
Sourcepub fn remove(&mut self, cap: Capability)
pub fn remove(&mut self, cap: Capability)
Remove a capability.
Sourcepub fn supports(&self, cap: Capability) -> bool
pub fn supports(&self, cap: Capability) -> bool
Check if a capability is supported.
Sourcepub fn supports_all(&self, caps: &[Capability]) -> bool
pub fn supports_all(&self, caps: &[Capability]) -> bool
Check if all given capabilities are supported.
Sourcepub fn supports_any(&self, caps: &[Capability]) -> bool
pub fn supports_any(&self, caps: &[Capability]) -> bool
Check if any of the given capabilities are supported.
Sourcepub fn list(&self) -> impl Iterator<Item = Capability>
pub fn list(&self) -> impl Iterator<Item = Capability>
List all supported capabilities.
Sourcepub fn merge(&mut self, other: &CapabilitySet)
pub fn merge(&mut self, other: &CapabilitySet)
Merge with another capability set.
Sourcepub fn intersection(&self, other: &CapabilitySet) -> CapabilitySet
pub fn intersection(&self, other: &CapabilitySet) -> CapabilitySet
Create the intersection of two capability sets.
Trait Implementations§
Source§impl Clone for CapabilitySet
impl Clone for CapabilitySet
Source§fn clone(&self) -> CapabilitySet
fn clone(&self) -> CapabilitySet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CapabilitySet
impl Debug for CapabilitySet
Source§impl Default for CapabilitySet
impl Default for CapabilitySet
Source§fn default() -> CapabilitySet
fn default() -> CapabilitySet
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for CapabilitySet
impl<'de> Deserialize<'de> for CapabilitySet
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CapabilitySet, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CapabilitySet, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Vec<Capability>> for CapabilitySet
impl From<Vec<Capability>> for CapabilitySet
Source§fn from(caps: Vec<Capability>) -> CapabilitySet
fn from(caps: Vec<Capability>) -> CapabilitySet
Converts to this type from the input type.
Source§impl FromIterator<Capability> for CapabilitySet
impl FromIterator<Capability> for CapabilitySet
Source§fn from_iter<T>(iter: T) -> CapabilitySetwhere
T: IntoIterator<Item = Capability>,
fn from_iter<T>(iter: T) -> CapabilitySetwhere
T: IntoIterator<Item = Capability>,
Creates a value from an iterator. Read more
Source§impl Serialize for CapabilitySet
impl Serialize for CapabilitySet
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for CapabilitySet
impl RefUnwindSafe for CapabilitySet
impl Send for CapabilitySet
impl Sync for CapabilitySet
impl Unpin for CapabilitySet
impl UnsafeUnpin for CapabilitySet
impl UnwindSafe for CapabilitySet
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
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> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more