[−][src]Trait idlset::AndNot
Bit trait representing the equivalent of a & (!b). This allows set operations such as "The set A does not contain any element of set B".
Associated Types
type Output
The type of set implementation to return.
Required methods
fn andnot(self, rhs: RHS) -> Self::Output
Perform an AndNot (exclude) operation between two sets. This returns
a new set containing the results. The set on the right is the candidate
set to exclude from the set of the left. As an example this would
behave as [1,2,3].andnot([2]) == [1, 3]
.
Implementors
impl AndNot<IDLBitRange> for IDLBitRange
[src]
type Output = Self
fn andnot(self, rhs: Self) -> Self
[src]
Perform an AndNot (exclude) operation between two sets. This returns a new set containing the results. The set on the right is the candidate set to exclude from the set of the left.
Examples
// Note the change to import the AndNot trait. use idlset::{IDLBitRange, AndNot}; let idl_a = IDLBitRange::from_iter(vec![1, 2, 3]); let idl_b = IDLBitRange::from_iter(vec![2]); let idl_result = idl_a.andnot(idl_b); let idl_expect = IDLBitRange::from_iter(vec![1, 3]); assert_eq!(idl_result, idl_expect);
// Note the change to import the AndNot trait. use idlset::{IDLBitRange, AndNot}; let idl_a = IDLBitRange::from_iter(vec![1, 2, 3]); let idl_b = IDLBitRange::from_iter(vec![2]); // Note how reversing a and b here will return an empty set. let idl_result = idl_b.andnot(idl_a); let idl_expect = IDLBitRange::new(); assert_eq!(idl_result, idl_expect);