Trait otter_api_tests::imports::failure::_core::ops::BitXor 1.0.0[−][src]
pub trait BitXor<Rhs = Self> { type Output; #[must_use] fn bitxor(self, rhs: Rhs) -> Self::Output; }
Expand description
The bitwise XOR operator ^
.
Note that Rhs
is Self
by default, but this is not mandatory.
Examples
An implementation of BitXor
that lifts ^
to a wrapper around bool
.
use std::ops::BitXor; #[derive(Debug, PartialEq)] struct Scalar(bool); impl BitXor for Scalar { type Output = Self; // rhs is the "right-hand side" of the expression `a ^ b` fn bitxor(self, rhs: Self) -> Self::Output { Self(self.0 ^ rhs.0) } } assert_eq!(Scalar(true) ^ Scalar(true), Scalar(false)); assert_eq!(Scalar(true) ^ Scalar(false), Scalar(true)); assert_eq!(Scalar(false) ^ Scalar(true), Scalar(true)); assert_eq!(Scalar(false) ^ Scalar(false), Scalar(false));
An implementation of BitXor
trait for a wrapper around Vec<bool>
.
use std::ops::BitXor; #[derive(Debug, PartialEq)] struct BooleanVector(Vec<bool>); impl BitXor for BooleanVector { type Output = Self; fn bitxor(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![false, true, true, false]); assert_eq!(bv1 ^ bv2, expected);
Associated Types
Required methods
Implementations on Foreign Types
impl BitXor<Op> for Op
impl BitXor<Op> for Op
impl BitXor<WatchMask> for WatchMask
impl BitXor<WatchMask> for WatchMask
impl BitXor<EventMask> for EventMask
impl BitXor<EventMask> for EventMask
impl BitXor<Transformations> for Transformations
impl BitXor<Transformations> for Transformations
impl BitXor<FileType> for FileType
impl BitXor<FileType> for FileType
impl<'_, '_, T, S1, S2> BitXor<&'_ IndexSet<T, S2>> for &'_ IndexSet<T, S1> where
T: Eq + Hash + Clone,
S1: BuildHasher + Default,
S2: BuildHasher,
[src]
impl<'_, '_, T, S1, S2> BitXor<&'_ IndexSet<T, S2>> for &'_ IndexSet<T, S1> where
T: Eq + Hash + Clone,
S1: BuildHasher + Default,
S2: BuildHasher,
[src]Returns the set symmetric-difference, cloned into a new set.
Values from self
are collected in their original order, followed by
values from other
in their original order.
pub fn bitxor(self, rhs: &HashSet<T, S>) -> HashSet<T, S>
pub fn bitxor(self, rhs: &HashSet<T, S>) -> HashSet<T, S>
Returns the symmetric difference 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![3, 4, 5].into_iter().collect(); let set = &a ^ &b; let mut i = 0; let expected = [1, 2, 4, 5]; for x in &set { assert!(expected.contains(x)); i += 1; } assert_eq!(i, expected.len());
type Output = HashSet<T, S>
Returns the left flags, but with all the right flags toggled.
type Output = Pkcs7Flags
Returns the left flags, but with all the right flags toggled.
type Output = X509VerifyFlags
Returns the left flags, but with all the right flags toggled.
type Output = ExtensionContext
Returns the left flags, but with all the right flags toggled.
type Output = SslVerifyMode
Returns the left flags, but with all the right flags toggled.
type Output = X509CheckFlags
Returns the left flags, but with all the right flags toggled.
type Output = CMSOptions
Returns the left flags, but with all the right flags toggled.
type Output = SslOptions
Returns the left flags, but with all the right flags toggled.
type Output = ShutdownState
Returns the left flags, but with all the right flags toggled.
type Output = SslSessionCacheMode
Implementors
impl BitXor<AccessFlags> for AccessFlags
impl BitXor<AccessFlags> for AccessFlags
pub fn bitxor(self, other: AccessFlags) -> AccessFlags
pub fn bitxor(self, other: AccessFlags) -> AccessFlags
Returns the left flags, but with all the right flags toggled.
type Output = AccessFlags
Xor between 0 and 0 ( 0 ^ 0 = 0)
Xor between 1 and 0 ( 1 ^ 0 = 1)
Xor between 0 and 1 ( 0 ^ 1 = 1)
Xor between 1 and 1 ( 1 ^ 1 = 0)
impl BitXor<FallocateFlags> for FallocateFlags
impl BitXor<FallocateFlags> for FallocateFlags
pub fn bitxor(self, other: FallocateFlags) -> FallocateFlags
pub fn bitxor(self, other: FallocateFlags) -> FallocateFlags
Returns the left flags, but with all the right flags toggled.
type Output = FallocateFlags
impl BitXor<SpliceFFlags> for SpliceFFlags
impl BitXor<SpliceFFlags> for SpliceFFlags
pub fn bitxor(self, other: SpliceFFlags) -> SpliceFFlags
pub fn bitxor(self, other: SpliceFFlags) -> SpliceFFlags
Returns the left flags, but with all the right flags toggled.
type Output = SpliceFFlags
impl BitXor<DeleteModuleFlags> for DeleteModuleFlags
impl BitXor<DeleteModuleFlags> for DeleteModuleFlags
pub fn bitxor(self, other: DeleteModuleFlags) -> DeleteModuleFlags
pub fn bitxor(self, other: DeleteModuleFlags) -> DeleteModuleFlags
Returns the left flags, but with all the right flags toggled.
type Output = DeleteModuleFlags
impl BitXor<ModuleInitFlags> for ModuleInitFlags
impl BitXor<ModuleInitFlags> for ModuleInitFlags
pub fn bitxor(self, other: ModuleInitFlags) -> ModuleInitFlags
pub fn bitxor(self, other: ModuleInitFlags) -> ModuleInitFlags
Returns the left flags, but with all the right flags toggled.
type Output = ModuleInitFlags
impl BitXor<InterfaceFlags> for InterfaceFlags
impl BitXor<InterfaceFlags> for InterfaceFlags
pub fn bitxor(self, other: InterfaceFlags) -> InterfaceFlags
pub fn bitxor(self, other: InterfaceFlags) -> InterfaceFlags
Returns the left flags, but with all the right flags toggled.
type Output = InterfaceFlags
impl BitXor<CloneFlags> for CloneFlags
impl BitXor<CloneFlags> for CloneFlags
pub fn bitxor(self, other: CloneFlags) -> CloneFlags
pub fn bitxor(self, other: CloneFlags) -> CloneFlags
Returns the left flags, but with all the right flags toggled.
type Output = CloneFlags
impl BitXor<EpollCreateFlags> for EpollCreateFlags
impl BitXor<EpollCreateFlags> for EpollCreateFlags
pub fn bitxor(self, other: EpollCreateFlags) -> EpollCreateFlags
pub fn bitxor(self, other: EpollCreateFlags) -> EpollCreateFlags
Returns the left flags, but with all the right flags toggled.
type Output = EpollCreateFlags
impl BitXor<EpollFlags> for EpollFlags
impl BitXor<EpollFlags> for EpollFlags
pub fn bitxor(self, other: EpollFlags) -> EpollFlags
pub fn bitxor(self, other: EpollFlags) -> EpollFlags
Returns the left flags, but with all the right flags toggled.
type Output = EpollFlags
impl BitXor<AddWatchFlags> for AddWatchFlags
impl BitXor<AddWatchFlags> for AddWatchFlags
pub fn bitxor(self, other: AddWatchFlags) -> AddWatchFlags
pub fn bitxor(self, other: AddWatchFlags) -> AddWatchFlags
Returns the left flags, but with all the right flags toggled.
type Output = AddWatchFlags
impl BitXor<MemFdCreateFlag> for MemFdCreateFlag
impl BitXor<MemFdCreateFlag> for MemFdCreateFlag
pub fn bitxor(self, other: MemFdCreateFlag) -> MemFdCreateFlag
pub fn bitxor(self, other: MemFdCreateFlag) -> MemFdCreateFlag
Returns the left flags, but with all the right flags toggled.
type Output = MemFdCreateFlag
impl BitXor<MRemapFlags> for MRemapFlags
impl BitXor<MRemapFlags> for MRemapFlags
pub fn bitxor(self, other: MRemapFlags) -> MRemapFlags
pub fn bitxor(self, other: MRemapFlags) -> MRemapFlags
Returns the left flags, but with all the right flags toggled.
type Output = MRemapFlags
impl BitXor<MlockAllFlags> for MlockAllFlags
impl BitXor<MlockAllFlags> for MlockAllFlags
pub fn bitxor(self, other: MlockAllFlags) -> MlockAllFlags
pub fn bitxor(self, other: MlockAllFlags) -> MlockAllFlags
Returns the left flags, but with all the right flags toggled.
type Output = MlockAllFlags
impl BitXor<QuotaValidFlags> for QuotaValidFlags
impl BitXor<QuotaValidFlags> for QuotaValidFlags
pub fn bitxor(self, other: QuotaValidFlags) -> QuotaValidFlags
pub fn bitxor(self, other: QuotaValidFlags) -> QuotaValidFlags
Returns the left flags, but with all the right flags toggled.
type Output = QuotaValidFlags
impl BitXor<ControlFlags> for ControlFlags
impl BitXor<ControlFlags> for ControlFlags
pub fn bitxor(self, other: ControlFlags) -> ControlFlags
pub fn bitxor(self, other: ControlFlags) -> ControlFlags
Returns the left flags, but with all the right flags toggled.
type Output = ControlFlags
impl BitXor<InputFlags> for InputFlags
impl BitXor<InputFlags> for InputFlags
pub fn bitxor(self, other: InputFlags) -> InputFlags
pub fn bitxor(self, other: InputFlags) -> InputFlags
Returns the left flags, but with all the right flags toggled.
type Output = InputFlags
impl BitXor<LocalFlags> for LocalFlags
impl BitXor<LocalFlags> for LocalFlags
pub fn bitxor(self, other: LocalFlags) -> LocalFlags
pub fn bitxor(self, other: LocalFlags) -> LocalFlags
Returns the left flags, but with all the right flags toggled.
type Output = LocalFlags
impl BitXor<OutputFlags> for OutputFlags
impl BitXor<OutputFlags> for OutputFlags
pub fn bitxor(self, other: OutputFlags) -> OutputFlags
pub fn bitxor(self, other: OutputFlags) -> OutputFlags
Returns the left flags, but with all the right flags toggled.
type Output = OutputFlags
impl BitXor<TimerFlags> for TimerFlags
impl BitXor<TimerFlags> for TimerFlags
pub fn bitxor(self, other: TimerFlags) -> TimerFlags
pub fn bitxor(self, other: TimerFlags) -> TimerFlags
Returns the left flags, but with all the right flags toggled.
type Output = TimerFlags
impl BitXor<TimerSetTimeFlags> for TimerSetTimeFlags
impl BitXor<TimerSetTimeFlags> for TimerSetTimeFlags
pub fn bitxor(self, other: TimerSetTimeFlags) -> TimerSetTimeFlags
pub fn bitxor(self, other: TimerSetTimeFlags) -> TimerSetTimeFlags
Returns the left flags, but with all the right flags toggled.
type Output = TimerSetTimeFlags
impl BitXor<WaitPidFlag> for WaitPidFlag
impl BitXor<WaitPidFlag> for WaitPidFlag
pub fn bitxor(self, other: WaitPidFlag) -> WaitPidFlag
pub fn bitxor(self, other: WaitPidFlag) -> WaitPidFlag
Returns the left flags, but with all the right flags toggled.
type Output = WaitPidFlag
Returns the symmetric difference of self
and rhs
as a new BTreeSet<T>
.
Examples
use std::collections::BTreeSet; let a: BTreeSet<_> = vec![1, 2, 3].into_iter().collect(); let b: BTreeSet<_> = vec![2, 3, 4].into_iter().collect(); let result = &a ^ &b; let result_vec: Vec<_> = result.into_iter().collect(); assert_eq!(result_vec, [1, 4]);
Returns the symmetric difference of self
and rhs
as a new HashSet<T, S>
.
Examples
use std::collections::HashSet; let a: HashSet<_> = vec![1, 2, 3].into_iter().collect(); let b: HashSet<_> = vec![3, 4, 5].into_iter().collect(); let set = &a ^ &b; let mut i = 0; let expected = [1, 2, 4, 5]; for x in &set { assert!(expected.contains(x)); i += 1; } assert_eq!(i, expected.len());
Xoring unsigned integers.
We use our PrivateXor
operator and then Trim
the output.