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<'_, '_, 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]impl<'_, '_, T, S> BitXor<&'_ HashSet<T, S>> for &'_ HashSet<T, S> where
T: Eq + Hash + Clone,
S: BuildHasher + Default,
impl<'_, '_, T, S> BitXor<&'_ HashSet<T, S>> for &'_ HashSet<T, S> where
T: Eq + Hash + Clone,
S: BuildHasher + Default,
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>
impl BitXor<SslSessionCacheMode> for SslSessionCacheMode
[src]
impl BitXor<SslSessionCacheMode> for SslSessionCacheMode
[src]pub fn bitxor(self, other: SslSessionCacheMode) -> SslSessionCacheMode
[src]
pub fn bitxor(self, other: SslSessionCacheMode) -> SslSessionCacheMode
[src]Returns the left flags, but with all the right flags toggled.
type Output = SslSessionCacheMode
impl BitXor<Pkcs7Flags> for Pkcs7Flags
[src]
impl BitXor<Pkcs7Flags> for Pkcs7Flags
[src]pub fn bitxor(self, other: Pkcs7Flags) -> Pkcs7Flags
[src]
pub fn bitxor(self, other: Pkcs7Flags) -> Pkcs7Flags
[src]Returns the left flags, but with all the right flags toggled.
type Output = Pkcs7Flags
impl BitXor<SslOptions> for SslOptions
[src]
impl BitXor<SslOptions> for SslOptions
[src]pub fn bitxor(self, other: SslOptions) -> SslOptions
[src]
pub fn bitxor(self, other: SslOptions) -> SslOptions
[src]Returns the left flags, but with all the right flags toggled.
type Output = SslOptions
impl BitXor<ShutdownState> for ShutdownState
[src]
impl BitXor<ShutdownState> for ShutdownState
[src]pub fn bitxor(self, other: ShutdownState) -> ShutdownState
[src]
pub fn bitxor(self, other: ShutdownState) -> ShutdownState
[src]Returns the left flags, but with all the right flags toggled.
type Output = ShutdownState
impl BitXor<CMSOptions> for CMSOptions
[src]
impl BitXor<CMSOptions> for CMSOptions
[src]pub fn bitxor(self, other: CMSOptions) -> CMSOptions
[src]
pub fn bitxor(self, other: CMSOptions) -> CMSOptions
[src]Returns the left flags, but with all the right flags toggled.
type Output = CMSOptions
impl BitXor<SslVerifyMode> for SslVerifyMode
[src]
impl BitXor<SslVerifyMode> for SslVerifyMode
[src]pub fn bitxor(self, other: SslVerifyMode) -> SslVerifyMode
[src]
pub fn bitxor(self, other: SslVerifyMode) -> SslVerifyMode
[src]Returns the left flags, but with all the right flags toggled.
type Output = SslVerifyMode
impl BitXor<ExtensionContext> for ExtensionContext
[src]
impl BitXor<ExtensionContext> for ExtensionContext
[src]pub fn bitxor(self, other: ExtensionContext) -> ExtensionContext
[src]
pub fn bitxor(self, other: ExtensionContext) -> ExtensionContext
[src]Returns the left flags, but with all the right flags toggled.
type Output = ExtensionContext
impl BitXor<X509VerifyFlags> for X509VerifyFlags
[src]
impl BitXor<X509VerifyFlags> for X509VerifyFlags
[src]pub fn bitxor(self, other: X509VerifyFlags) -> X509VerifyFlags
[src]
pub fn bitxor(self, other: X509VerifyFlags) -> X509VerifyFlags
[src]Returns the left flags, but with all the right flags toggled.
type Output = X509VerifyFlags
impl BitXor<X509CheckFlags> for X509CheckFlags
[src]
impl BitXor<X509CheckFlags> for X509CheckFlags
[src]pub fn bitxor(self, other: X509CheckFlags) -> X509CheckFlags
[src]
pub fn bitxor(self, other: X509CheckFlags) -> X509CheckFlags
[src]Returns the left flags, but with all the right flags toggled.
type Output = X509CheckFlags
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
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
impl<'_, '_, T> BitXor<&'_ BTreeSet<T>> for &'_ BTreeSet<T> where
T: Ord + Clone,
[src]
impl<'_, '_, T> BitXor<&'_ BTreeSet<T>> for &'_ BTreeSet<T> where
T: Ord + Clone,
[src]pub fn bitxor(self, rhs: &BTreeSet<T>) -> BTreeSet<T>
[src]
pub fn bitxor(self, rhs: &BTreeSet<T>) -> BTreeSet<T>
[src]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]);
impl<'_, '_, T, S> BitXor<&'_ HashSet<T, S>> for &'_ otter_api_tests::shapelib::HashSet<T, S> where
T: Eq + Hash + Clone,
S: BuildHasher + Default,
[src]
impl<'_, '_, T, S> BitXor<&'_ HashSet<T, S>> for &'_ otter_api_tests::shapelib::HashSet<T, S> where
T: Eq + Hash + Clone,
S: BuildHasher + Default,
[src]pub fn bitxor(self, rhs: &HashSet<T, S>) -> HashSet<T, S>
[src]
pub fn bitxor(self, rhs: &HashSet<T, S>) -> HashSet<T, S>
[src]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());