Expand description
The bitwise AND operator &
.
Note that Rhs
is Self
by default, but this is not mandatory.
Examples
An implementation of BitAnd
for a wrapper around bool
.
use std::ops::BitAnd;
#[derive(Debug, PartialEq)]
struct Scalar(bool);
impl BitAnd for Scalar {
type Output = Self;
// rhs is the "right-hand side" of the expression `a & b`
fn bitand(self, rhs: Self) -> Self::Output {
Self(self.0 & rhs.0)
}
}
assert_eq!(Scalar(true) & Scalar(true), Scalar(true));
assert_eq!(Scalar(true) & Scalar(false), Scalar(false));
assert_eq!(Scalar(false) & Scalar(true), Scalar(false));
assert_eq!(Scalar(false) & Scalar(false), Scalar(false));
An implementation of BitAnd
for a wrapper around Vec<bool>
.
use std::ops::BitAnd;
#[derive(Debug, PartialEq)]
struct BooleanVector(Vec<bool>);
impl BitAnd for BooleanVector {
type Output = Self;
fn bitand(self, Self(rhs): Self) -> Self::Output {
let Self(lhs) = self;
assert_eq!(lhs.len(), rhs.len());
Self(
lhs.iter()
.zip(rhs.iter())
.map(|(x, y)| *x & *y)
.collect()
)
}
}
let bv1 = BooleanVector(vec![true, true, false, false]);
let bv2 = BooleanVector(vec![true, false, true, false]);
let expected = BooleanVector(vec![true, false, false, false]);
assert_eq!(bv1 & bv2, expected);
Associated Types
Required methods
Implementations on Foreign Types
sourceimpl<T, S> BitAnd<&'_ HashSet<T, S>> for &'_ HashSet<T, S> where
T: Eq + Hash + Clone,
S: BuildHasher + Default,
impl<T, S> BitAnd<&'_ HashSet<T, S>> for &'_ HashSet<T, S> where
T: Eq + Hash + Clone,
S: BuildHasher + Default,
sourcepub fn bitand(self, rhs: &HashSet<T, S>) -> HashSet<T, S>
pub fn bitand(self, rhs: &HashSet<T, S>) -> HashSet<T, S>
Returns the intersection of self
and rhs
as a new HashSet<T, S>
.
Examples
use std::collections::HashSet;
let a = HashSet::from([1, 2, 3]);
let b = HashSet::from([2, 3, 4]);
let set = &a & &b;
let mut i = 0;
let expected = [2, 3];
for x in &set {
assert!(expected.contains(x));
i += 1;
}
assert_eq!(i, expected.len());
type Output = HashSet<T, S>
sourceimpl BitAnd<&'_ Saturating<i32>> for Saturating<i32>
impl BitAnd<&'_ Saturating<i32>> for Saturating<i32>
type Output = <Saturating<i32> as BitAnd<Saturating<i32>>>::Output
pub fn bitand(
self,
other: &Saturating<i32>
) -> <Saturating<i32> as BitAnd<Saturating<i32>>>::Output
sourceimpl<const N: usize> BitAnd<Simd<u32, N>> for Simd<u32, N> where
u32: SimdElement,
LaneCount<N>: SupportedLaneCount,
impl<const N: usize> BitAnd<Simd<u32, N>> for Simd<u32, N> where
u32: SimdElement,
LaneCount<N>: SupportedLaneCount,
sourceimpl<const N: usize> BitAnd<Simd<isize, N>> for Simd<isize, N> where
isize: SimdElement,
LaneCount<N>: SupportedLaneCount,
impl<const N: usize> BitAnd<Simd<isize, N>> for Simd<isize, N> where
isize: SimdElement,
LaneCount<N>: SupportedLaneCount,
sourceimpl BitAnd<&'_ Saturating<u32>> for Saturating<u32>
impl BitAnd<&'_ Saturating<u32>> for Saturating<u32>
type Output = <Saturating<u32> as BitAnd<Saturating<u32>>>::Output
pub fn bitand(
self,
other: &Saturating<u32>
) -> <Saturating<u32> as BitAnd<Saturating<u32>>>::Output
sourceimpl BitAnd<&'_ Saturating<i128>> for &'_ Saturating<i128>
impl BitAnd<&'_ Saturating<i128>> for &'_ Saturating<i128>
type Output = <Saturating<i128> as BitAnd<Saturating<i128>>>::Output
pub fn bitand(
self,
other: &Saturating<i128>
) -> <Saturating<i128> as BitAnd<Saturating<i128>>>::Output
sourceimpl BitAnd<Saturating<usize>> for Saturating<usize>
impl BitAnd<Saturating<usize>> for Saturating<usize>
type Output = Saturating<usize>
pub fn bitand(self, other: Saturating<usize>) -> Saturating<usize>
sourceimpl<'a> BitAnd<Saturating<u16>> for &'a Saturating<u16>
impl<'a> BitAnd<Saturating<u16>> for &'a Saturating<u16>
type Output = <Saturating<u16> as BitAnd<Saturating<u16>>>::Output
pub fn bitand(
self,
other: Saturating<u16>
) -> <Saturating<u16> as BitAnd<Saturating<u16>>>::Output
sourceimpl<'lhs, 'rhs, T, const LANES: usize> BitAnd<&'rhs Simd<T, LANES>> for &'lhs Simd<T, LANES> where
T: SimdElement,
Simd<T, LANES>: BitAnd<Simd<T, LANES>>,
LaneCount<LANES>: SupportedLaneCount,
<Simd<T, LANES> as BitAnd<Simd<T, LANES>>>::Output == Simd<T, LANES>,
impl<'lhs, 'rhs, T, const LANES: usize> BitAnd<&'rhs Simd<T, LANES>> for &'lhs Simd<T, LANES> where
T: SimdElement,
Simd<T, LANES>: BitAnd<Simd<T, LANES>>,
LaneCount<LANES>: SupportedLaneCount,
<Simd<T, LANES> as BitAnd<Simd<T, LANES>>>::Output == Simd<T, LANES>,
sourceimpl BitAnd<&'_ Saturating<usize>> for &'_ Saturating<usize>
impl BitAnd<&'_ Saturating<usize>> for &'_ Saturating<usize>
type Output = <Saturating<usize> as BitAnd<Saturating<usize>>>::Output
pub fn bitand(
self,
other: &Saturating<usize>
) -> <Saturating<usize> as BitAnd<Saturating<usize>>>::Output
sourceimpl BitAnd<&'_ Saturating<u16>> for Saturating<u16>
impl BitAnd<&'_ Saturating<u16>> for Saturating<u16>
type Output = <Saturating<u16> as BitAnd<Saturating<u16>>>::Output
pub fn bitand(
self,
other: &Saturating<u16>
) -> <Saturating<u16> as BitAnd<Saturating<u16>>>::Output
sourceimpl BitAnd<&'_ Saturating<i64>> for Saturating<i64>
impl BitAnd<&'_ Saturating<i64>> for Saturating<i64>
type Output = <Saturating<i64> as BitAnd<Saturating<i64>>>::Output
pub fn bitand(
self,
other: &Saturating<i64>
) -> <Saturating<i64> as BitAnd<Saturating<i64>>>::Output
sourceimpl BitAnd<&'_ Saturating<isize>> for &'_ Saturating<isize>
impl BitAnd<&'_ Saturating<isize>> for &'_ Saturating<isize>
type Output = <Saturating<isize> as BitAnd<Saturating<isize>>>::Output
pub fn bitand(
self,
other: &Saturating<isize>
) -> <Saturating<isize> as BitAnd<Saturating<isize>>>::Output
sourceimpl<const N: usize> BitAnd<Simd<u16, N>> for Simd<u16, N> where
u16: SimdElement,
LaneCount<N>: SupportedLaneCount,
impl<const N: usize> BitAnd<Simd<u16, N>> for Simd<u16, N> where
u16: SimdElement,
LaneCount<N>: SupportedLaneCount,
sourceimpl<'a> BitAnd<Saturating<u128>> for &'a Saturating<u128>
impl<'a> BitAnd<Saturating<u128>> for &'a Saturating<u128>
type Output = <Saturating<u128> as BitAnd<Saturating<u128>>>::Output
pub fn bitand(
self,
other: Saturating<u128>
) -> <Saturating<u128> as BitAnd<Saturating<u128>>>::Output
sourceimpl<const N: usize> BitAnd<Simd<i32, N>> for Simd<i32, N> where
i32: SimdElement,
LaneCount<N>: SupportedLaneCount,
impl<const N: usize> BitAnd<Simd<i32, N>> for Simd<i32, N> where
i32: SimdElement,
LaneCount<N>: SupportedLaneCount,
sourceimpl BitAnd<&'_ Saturating<i16>> for &'_ Saturating<i16>
impl BitAnd<&'_ Saturating<i16>> for &'_ Saturating<i16>
type Output = <Saturating<i16> as BitAnd<Saturating<i16>>>::Output
pub fn bitand(
self,
other: &Saturating<i16>
) -> <Saturating<i16> as BitAnd<Saturating<i16>>>::Output
sourceimpl BitAnd<&'_ Saturating<u8>> for Saturating<u8>
impl BitAnd<&'_ Saturating<u8>> for Saturating<u8>
type Output = <Saturating<u8> as BitAnd<Saturating<u8>>>::Output
pub fn bitand(
self,
other: &Saturating<u8>
) -> <Saturating<u8> as BitAnd<Saturating<u8>>>::Output
sourceimpl BitAnd<&'_ Saturating<u16>> for &'_ Saturating<u16>
impl BitAnd<&'_ Saturating<u16>> for &'_ Saturating<u16>
type Output = <Saturating<u16> as BitAnd<Saturating<u16>>>::Output
pub fn bitand(
self,
other: &Saturating<u16>
) -> <Saturating<u16> as BitAnd<Saturating<u16>>>::Output
sourceimpl<'a> BitAnd<Saturating<i32>> for &'a Saturating<i32>
impl<'a> BitAnd<Saturating<i32>> for &'a Saturating<i32>
type Output = <Saturating<i32> as BitAnd<Saturating<i32>>>::Output
pub fn bitand(
self,
other: Saturating<i32>
) -> <Saturating<i32> as BitAnd<Saturating<i32>>>::Output
sourceimpl<'a> BitAnd<Saturating<u32>> for &'a Saturating<u32>
impl<'a> BitAnd<Saturating<u32>> for &'a Saturating<u32>
type Output = <Saturating<u32> as BitAnd<Saturating<u32>>>::Output
pub fn bitand(
self,
other: Saturating<u32>
) -> <Saturating<u32> as BitAnd<Saturating<u32>>>::Output
sourceimpl<'a> BitAnd<Saturating<isize>> for &'a Saturating<isize>
impl<'a> BitAnd<Saturating<isize>> for &'a Saturating<isize>
type Output = <Saturating<isize> as BitAnd<Saturating<isize>>>::Output
pub fn bitand(
self,
other: Saturating<isize>
) -> <Saturating<isize> as BitAnd<Saturating<isize>>>::Output
sourceimpl<'a> BitAnd<Saturating<i64>> for &'a Saturating<i64>
impl<'a> BitAnd<Saturating<i64>> for &'a Saturating<i64>
type Output = <Saturating<i64> as BitAnd<Saturating<i64>>>::Output
pub fn bitand(
self,
other: Saturating<i64>
) -> <Saturating<i64> as BitAnd<Saturating<i64>>>::Output
sourceimpl BitAnd<&'_ Saturating<i64>> for &'_ Saturating<i64>
impl BitAnd<&'_ Saturating<i64>> for &'_ Saturating<i64>
type Output = <Saturating<i64> as BitAnd<Saturating<i64>>>::Output
pub fn bitand(
self,
other: &Saturating<i64>
) -> <Saturating<i64> as BitAnd<Saturating<i64>>>::Output
sourceimpl<'a> BitAnd<Saturating<usize>> for &'a Saturating<usize>
impl<'a> BitAnd<Saturating<usize>> for &'a Saturating<usize>
type Output = <Saturating<usize> as BitAnd<Saturating<usize>>>::Output
pub fn bitand(
self,
other: Saturating<usize>
) -> <Saturating<usize> as BitAnd<Saturating<usize>>>::Output
sourceimpl BitAnd<&'_ Saturating<u128>> for &'_ Saturating<u128>
impl BitAnd<&'_ Saturating<u128>> for &'_ Saturating<u128>
type Output = <Saturating<u128> as BitAnd<Saturating<u128>>>::Output
pub fn bitand(
self,
other: &Saturating<u128>
) -> <Saturating<u128> as BitAnd<Saturating<u128>>>::Output
sourceimpl<'a> BitAnd<Saturating<u64>> for &'a Saturating<u64>
impl<'a> BitAnd<Saturating<u64>> for &'a Saturating<u64>
type Output = <Saturating<u64> as BitAnd<Saturating<u64>>>::Output
pub fn bitand(
self,
other: Saturating<u64>
) -> <Saturating<u64> as BitAnd<Saturating<u64>>>::Output
sourceimpl BitAnd<Saturating<i16>> for Saturating<i16>
impl BitAnd<Saturating<i16>> for Saturating<i16>
type Output = Saturating<i16>
pub fn bitand(self, other: Saturating<i16>) -> Saturating<i16>
sourceimpl BitAnd<Saturating<isize>> for Saturating<isize>
impl BitAnd<Saturating<isize>> for Saturating<isize>
type Output = Saturating<isize>
pub fn bitand(self, other: Saturating<isize>) -> Saturating<isize>
sourceimpl BitAnd<Saturating<u32>> for Saturating<u32>
impl BitAnd<Saturating<u32>> for Saturating<u32>
type Output = Saturating<u32>
pub fn bitand(self, other: Saturating<u32>) -> Saturating<u32>
sourceimpl BitAnd<&'_ Saturating<i32>> for &'_ Saturating<i32>
impl BitAnd<&'_ Saturating<i32>> for &'_ Saturating<i32>
type Output = <Saturating<i32> as BitAnd<Saturating<i32>>>::Output
pub fn bitand(
self,
other: &Saturating<i32>
) -> <Saturating<i32> as BitAnd<Saturating<i32>>>::Output
sourceimpl<'a> BitAnd<Saturating<u8>> for &'a Saturating<u8>
impl<'a> BitAnd<Saturating<u8>> for &'a Saturating<u8>
type Output = <Saturating<u8> as BitAnd<Saturating<u8>>>::Output
pub fn bitand(
self,
other: Saturating<u8>
) -> <Saturating<u8> as BitAnd<Saturating<u8>>>::Output
sourceimpl BitAnd<Saturating<u16>> for Saturating<u16>
impl BitAnd<Saturating<u16>> for Saturating<u16>
type Output = Saturating<u16>
pub fn bitand(self, other: Saturating<u16>) -> Saturating<u16>
sourceimpl<const N: usize> BitAnd<Simd<u8, N>> for Simd<u8, N> where
u8: SimdElement,
LaneCount<N>: SupportedLaneCount,
impl<const N: usize> BitAnd<Simd<u8, N>> for Simd<u8, N> where
u8: SimdElement,
LaneCount<N>: SupportedLaneCount,
sourceimpl BitAnd<Saturating<u8>> for Saturating<u8>
impl BitAnd<Saturating<u8>> for Saturating<u8>
type Output = Saturating<u8>
pub fn bitand(self, other: Saturating<u8>) -> Saturating<u8>
sourceimpl BitAnd<&'_ Saturating<i8>> for Saturating<i8>
impl BitAnd<&'_ Saturating<i8>> for Saturating<i8>
type Output = <Saturating<i8> as BitAnd<Saturating<i8>>>::Output
pub fn bitand(
self,
other: &Saturating<i8>
) -> <Saturating<i8> as BitAnd<Saturating<i8>>>::Output
sourceimpl<T, const LANES: usize> BitAnd<Simd<T, LANES>> for &'_ Simd<T, LANES> where
T: SimdElement,
Simd<T, LANES>: BitAnd<Simd<T, LANES>>,
LaneCount<LANES>: SupportedLaneCount,
<Simd<T, LANES> as BitAnd<Simd<T, LANES>>>::Output == Simd<T, LANES>,
impl<T, const LANES: usize> BitAnd<Simd<T, LANES>> for &'_ Simd<T, LANES> where
T: SimdElement,
Simd<T, LANES>: BitAnd<Simd<T, LANES>>,
LaneCount<LANES>: SupportedLaneCount,
<Simd<T, LANES> as BitAnd<Simd<T, LANES>>>::Output == Simd<T, LANES>,
sourceimpl BitAnd<&'_ Saturating<i16>> for Saturating<i16>
impl BitAnd<&'_ Saturating<i16>> for Saturating<i16>
type Output = <Saturating<i16> as BitAnd<Saturating<i16>>>::Output
pub fn bitand(
self,
other: &Saturating<i16>
) -> <Saturating<i16> as BitAnd<Saturating<i16>>>::Output
sourceimpl BitAnd<&'_ Saturating<u128>> for Saturating<u128>
impl BitAnd<&'_ Saturating<u128>> for Saturating<u128>
type Output = <Saturating<u128> as BitAnd<Saturating<u128>>>::Output
pub fn bitand(
self,
other: &Saturating<u128>
) -> <Saturating<u128> as BitAnd<Saturating<u128>>>::Output
sourceimpl BitAnd<&'_ Saturating<i128>> for Saturating<i128>
impl BitAnd<&'_ Saturating<i128>> for Saturating<i128>
type Output = <Saturating<i128> as BitAnd<Saturating<i128>>>::Output
pub fn bitand(
self,
other: &Saturating<i128>
) -> <Saturating<i128> as BitAnd<Saturating<i128>>>::Output
sourceimpl<'a> BitAnd<Saturating<i128>> for &'a Saturating<i128>
impl<'a> BitAnd<Saturating<i128>> for &'a Saturating<i128>
type Output = <Saturating<i128> as BitAnd<Saturating<i128>>>::Output
pub fn bitand(
self,
other: Saturating<i128>
) -> <Saturating<i128> as BitAnd<Saturating<i128>>>::Output
sourceimpl<T, const LANES: usize> BitAnd<&'_ Simd<T, LANES>> for Simd<T, LANES> where
T: SimdElement,
Simd<T, LANES>: BitAnd<Simd<T, LANES>>,
LaneCount<LANES>: SupportedLaneCount,
<Simd<T, LANES> as BitAnd<Simd<T, LANES>>>::Output == Simd<T, LANES>,
impl<T, const LANES: usize> BitAnd<&'_ Simd<T, LANES>> for Simd<T, LANES> where
T: SimdElement,
Simd<T, LANES>: BitAnd<Simd<T, LANES>>,
LaneCount<LANES>: SupportedLaneCount,
<Simd<T, LANES> as BitAnd<Simd<T, LANES>>>::Output == Simd<T, LANES>,
sourceimpl<'a> BitAnd<Saturating<i8>> for &'a Saturating<i8>
impl<'a> BitAnd<Saturating<i8>> for &'a Saturating<i8>
type Output = <Saturating<i8> as BitAnd<Saturating<i8>>>::Output
pub fn bitand(
self,
other: Saturating<i8>
) -> <Saturating<i8> as BitAnd<Saturating<i8>>>::Output
sourceimpl BitAnd<Saturating<i8>> for Saturating<i8>
impl BitAnd<Saturating<i8>> for Saturating<i8>
type Output = Saturating<i8>
pub fn bitand(self, other: Saturating<i8>) -> Saturating<i8>
sourceimpl<const N: usize> BitAnd<Simd<i8, N>> for Simd<i8, N> where
i8: SimdElement,
LaneCount<N>: SupportedLaneCount,
impl<const N: usize> BitAnd<Simd<i8, N>> for Simd<i8, N> where
i8: SimdElement,
LaneCount<N>: SupportedLaneCount,
sourceimpl BitAnd<&'_ Saturating<u32>> for &'_ Saturating<u32>
impl BitAnd<&'_ Saturating<u32>> for &'_ Saturating<u32>
type Output = <Saturating<u32> as BitAnd<Saturating<u32>>>::Output
pub fn bitand(
self,
other: &Saturating<u32>
) -> <Saturating<u32> as BitAnd<Saturating<u32>>>::Output
sourceimpl BitAnd<&'_ Saturating<u8>> for &'_ Saturating<u8>
impl BitAnd<&'_ Saturating<u8>> for &'_ Saturating<u8>
type Output = <Saturating<u8> as BitAnd<Saturating<u8>>>::Output
pub fn bitand(
self,
other: &Saturating<u8>
) -> <Saturating<u8> as BitAnd<Saturating<u8>>>::Output
sourceimpl BitAnd<Saturating<i64>> for Saturating<i64>
impl BitAnd<Saturating<i64>> for Saturating<i64>
type Output = Saturating<i64>
pub fn bitand(self, other: Saturating<i64>) -> Saturating<i64>
sourceimpl BitAnd<Saturating<u64>> for Saturating<u64>
impl BitAnd<Saturating<u64>> for Saturating<u64>
type Output = Saturating<u64>
pub fn bitand(self, other: Saturating<u64>) -> Saturating<u64>
sourceimpl<T, const LANES: usize> BitAnd<Mask<T, LANES>> for Mask<T, LANES> where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
impl<T, const LANES: usize> BitAnd<Mask<T, LANES>> for Mask<T, LANES> where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
sourceimpl<const N: usize> BitAnd<Simd<i64, N>> for Simd<i64, N> where
i64: SimdElement,
LaneCount<N>: SupportedLaneCount,
impl<const N: usize> BitAnd<Simd<i64, N>> for Simd<i64, N> where
i64: SimdElement,
LaneCount<N>: SupportedLaneCount,
sourceimpl<T, const LANES: usize> BitAnd<Mask<T, LANES>> for bool where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
impl<T, const LANES: usize> BitAnd<Mask<T, LANES>> for bool where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
sourceimpl BitAnd<Saturating<u128>> for Saturating<u128>
impl BitAnd<Saturating<u128>> for Saturating<u128>
type Output = Saturating<u128>
pub fn bitand(self, other: Saturating<u128>) -> Saturating<u128>
sourceimpl<const N: usize> BitAnd<Simd<u64, N>> for Simd<u64, N> where
u64: SimdElement,
LaneCount<N>: SupportedLaneCount,
impl<const N: usize> BitAnd<Simd<u64, N>> for Simd<u64, N> where
u64: SimdElement,
LaneCount<N>: SupportedLaneCount,
sourceimpl BitAnd<&'_ Saturating<u64>> for &'_ Saturating<u64>
impl BitAnd<&'_ Saturating<u64>> for &'_ Saturating<u64>
type Output = <Saturating<u64> as BitAnd<Saturating<u64>>>::Output
pub fn bitand(
self,
other: &Saturating<u64>
) -> <Saturating<u64> as BitAnd<Saturating<u64>>>::Output
sourceimpl BitAnd<&'_ Saturating<isize>> for Saturating<isize>
impl BitAnd<&'_ Saturating<isize>> for Saturating<isize>
type Output = <Saturating<isize> as BitAnd<Saturating<isize>>>::Output
pub fn bitand(
self,
other: &Saturating<isize>
) -> <Saturating<isize> as BitAnd<Saturating<isize>>>::Output
sourceimpl<'a> BitAnd<Saturating<i16>> for &'a Saturating<i16>
impl<'a> BitAnd<Saturating<i16>> for &'a Saturating<i16>
type Output = <Saturating<i16> as BitAnd<Saturating<i16>>>::Output
pub fn bitand(
self,
other: Saturating<i16>
) -> <Saturating<i16> as BitAnd<Saturating<i16>>>::Output
sourceimpl<const N: usize> BitAnd<Simd<usize, N>> for Simd<usize, N> where
usize: SimdElement,
LaneCount<N>: SupportedLaneCount,
impl<const N: usize> BitAnd<Simd<usize, N>> for Simd<usize, N> where
usize: SimdElement,
LaneCount<N>: SupportedLaneCount,
sourceimpl<const N: usize> BitAnd<Simd<i16, N>> for Simd<i16, N> where
i16: SimdElement,
LaneCount<N>: SupportedLaneCount,
impl<const N: usize> BitAnd<Simd<i16, N>> for Simd<i16, N> where
i16: SimdElement,
LaneCount<N>: SupportedLaneCount,
sourceimpl BitAnd<&'_ Saturating<usize>> for Saturating<usize>
impl BitAnd<&'_ Saturating<usize>> for Saturating<usize>
type Output = <Saturating<usize> as BitAnd<Saturating<usize>>>::Output
pub fn bitand(
self,
other: &Saturating<usize>
) -> <Saturating<usize> as BitAnd<Saturating<usize>>>::Output
sourceimpl BitAnd<&'_ Saturating<i8>> for &'_ Saturating<i8>
impl BitAnd<&'_ Saturating<i8>> for &'_ Saturating<i8>
type Output = <Saturating<i8> as BitAnd<Saturating<i8>>>::Output
pub fn bitand(
self,
other: &Saturating<i8>
) -> <Saturating<i8> as BitAnd<Saturating<i8>>>::Output
sourceimpl BitAnd<&'_ Saturating<u64>> for Saturating<u64>
impl BitAnd<&'_ Saturating<u64>> for Saturating<u64>
type Output = <Saturating<u64> as BitAnd<Saturating<u64>>>::Output
pub fn bitand(
self,
other: &Saturating<u64>
) -> <Saturating<u64> as BitAnd<Saturating<u64>>>::Output
sourceimpl BitAnd<Saturating<i32>> for Saturating<i32>
impl BitAnd<Saturating<i32>> for Saturating<i32>
type Output = Saturating<i32>
pub fn bitand(self, other: Saturating<i32>) -> Saturating<i32>
sourceimpl<T, const LANES: usize> BitAnd<bool> for Mask<T, LANES> where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
impl<T, const LANES: usize> BitAnd<bool> for Mask<T, LANES> where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
sourceimpl BitAnd<Saturating<i128>> for Saturating<i128>
impl BitAnd<Saturating<i128>> for Saturating<i128>
type Output = Saturating<i128>
pub fn bitand(self, other: Saturating<i128>) -> Saturating<i128>
sourceimpl<T> BitAnd<&'_ BTreeSet<T>> for &'_ BTreeSet<T> where
T: Ord + Clone,
impl<T> BitAnd<&'_ BTreeSet<T>> for &'_ BTreeSet<T> where
T: Ord + Clone,
sourcepub fn bitand(self, rhs: &BTreeSet<T>) -> BTreeSet<T>
pub fn bitand(self, rhs: &BTreeSet<T>) -> BTreeSet<T>
Returns the intersection of self
and rhs
as a new BTreeSet<T>
.
Examples
use std::collections::BTreeSet;
let a = BTreeSet::from([1, 2, 3]);
let b = BTreeSet::from([2, 3, 4]);
let result = &a & &b;
let result_vec: Vec<_> = result.into_iter().collect();
assert_eq!(result_vec, [2, 3]);
type Output = BTreeSet<T>
sourceimpl<T, S1, S2> BitAnd<&'_ IndexSet<T, S2>> for &'_ IndexSet<T, S1> where
T: Eq + Hash + Clone,
S1: BuildHasher + Default,
S2: BuildHasher,
impl<T, S1, S2> BitAnd<&'_ IndexSet<T, S2>> for &'_ IndexSet<T, S1> where
T: Eq + Hash + Clone,
S1: BuildHasher + Default,
S2: BuildHasher,
impl<T, S, A> BitAnd<&'_ HashSet<T, S, A>> for &'_ HashSet<T, S, A> where
T: Eq + Hash + Clone,
S: BuildHasher + Default,
A: Allocator + Clone,
impl<T, S, A> BitAnd<&'_ HashSet<T, S, A>> for &'_ HashSet<T, S, A> where
T: Eq + Hash + Clone,
S: BuildHasher + Default,
A: Allocator + Clone,
pub fn bitand(self, rhs: &HashSet<T, S, A>) -> HashSet<T, S, Global>
pub fn bitand(self, rhs: &HashSet<T, S, A>) -> HashSet<T, S, Global>
Returns the intersection of self
and rhs
as a new HashSet<T, S>
.
Examples
use hashbrown::HashSet;
let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
let b: HashSet<_> = vec![2, 3, 4].into_iter().collect();
let set = &a & &b;
let mut i = 0;
let expected = [2, 3];
for x in &set {
assert!(expected.contains(x));
i += 1;
}
assert_eq!(i, expected.len());
type Output = HashSet<T, S, Global>
impl<T, S, A> BitAnd<&'_ HashSet<T, S, A>> for &'_ HashSet<T, S, A> where
T: Eq + Hash + Clone,
S: BuildHasher + Default,
A: Allocator + Clone,
impl<T, S, A> BitAnd<&'_ HashSet<T, S, A>> for &'_ HashSet<T, S, A> where
T: Eq + Hash + Clone,
S: BuildHasher + Default,
A: Allocator + Clone,
pub fn bitand(self, rhs: &HashSet<T, S, A>) -> HashSet<T, S, Global>
pub fn bitand(self, rhs: &HashSet<T, S, A>) -> HashSet<T, S, Global>
Returns the intersection of self
and rhs
as a new HashSet<T, S>
.
Examples
use hashbrown::HashSet;
let a: HashSet<_> = vec![1, 2, 3].into_iter().collect();
let b: HashSet<_> = vec![2, 3, 4].into_iter().collect();
let set = &a & &b;
let mut i = 0;
let expected = [2, 3];
for x in &set {
assert!(expected.contains(x));
i += 1;
}
assert_eq!(i, expected.len());