The bitwise XOR operator ^.

Signature

pub trait BitXor

Examples

An implementation of BitXor for a wrapper around bool.
use core::traits::BitXor;

#[derive(Drop, PartialEq)]
struct Scalar {
    inner: bool,
}

impl BitXorScalar of BitXor {
    fn bitxor(lhs: Scalar, rhs: Scalar) -> Scalar {
        Scalar { inner: lhs.inner ^ rhs.inner }
    }
}

assert!(Scalar { inner: true } ^ Scalar { inner: true } == Scalar { inner: false });
assert!(Scalar { inner: true } ^ Scalar { inner: false } == Scalar { inner: true });
assert!(Scalar { inner: false } ^ Scalar { inner: true } == Scalar { inner: true });
assert!(Scalar { inner: false } ^ Scalar { inner: false } == Scalar { inner: false });

Trait functions

bitxor

Performs the ^ operation.

Signature

fn bitxor(lhs: T, rhs: T) -> T

Examples

assert!(1_u8 ^ 2_u8 == 3);