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 with_capabilities(caps: impl IntoIterator<Item = Capability>) -> Self
pub fn with_capabilities(caps: impl IntoIterator<Item = Capability>) -> Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
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 From<Vec<Capability>> for CapabilitySet
impl From<Vec<Capability>> for CapabilitySet
Source§fn from(caps: Vec<Capability>) -> Self
fn from(caps: Vec<Capability>) -> Self
Converts to this type from the input type.
Source§impl FromIterator<Capability> for CapabilitySet
impl FromIterator<Capability> for CapabilitySet
Source§fn from_iter<T: IntoIterator<Item = Capability>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Capability>>(iter: T) -> Self
Creates a value from an iterator. 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