pub enum BitwiseOperator {
And,
Or,
Xor,
Not,
ShiftLeft,
ShiftRight,
AndWord,
OrWord,
XorWord,
NotWord,
}Expand description
A bitwise operator.
Two measured behaviors make this family the easiest to misread:
AND,OR,XORandNOTare bitwise, not logical, despite reading like English.6 AND 3is2, nottrue. The logical forms live inLogicalOperator.^is exclusive-or, not exponentiation.2^3is1, not8.
Complement operates on 32 bits and yields an unsigned result: ~0 is
4294967295, not -1.
Variants§
And
Bitwise and, &.
Or
Bitwise or, |.
Xor
Bitwise exclusive-or, ^.
Not
Bitwise complement, ~.
ShiftLeft
Left shift, <<.
ShiftRight
Right shift, >>.
AndWord
Bitwise and, AND, the word spelling of Self::And.
OrWord
Bitwise or, OR, the word spelling of Self::Or.
XorWord
Bitwise exclusive-or, XOR, the word spelling of Self::Xor.
NotWord
Bitwise complement, NOT, the word spelling of Self::Not.
Implementations§
Source§impl BitwiseOperator
impl BitwiseOperator
Sourcepub const fn precedence(self) -> u8
pub const fn precedence(self) -> u8
Binding strength; lower binds tighter. Measured, see super.
Sourcepub const fn alternate_spelling(self) -> Option<Self>
pub const fn alternate_spelling(self) -> Option<Self>
The other spelling, for operators that have one.
Trait Implementations§
Source§impl Clone for BitwiseOperator
impl Clone for BitwiseOperator
Source§fn clone(&self) -> BitwiseOperator
fn clone(&self) -> BitwiseOperator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for BitwiseOperator
Source§impl Debug for BitwiseOperator
impl Debug for BitwiseOperator
impl Eq for BitwiseOperator
Source§impl Hash for BitwiseOperator
impl Hash for BitwiseOperator
Source§impl PartialEq for BitwiseOperator
impl PartialEq for BitwiseOperator
impl StructuralPartialEq for BitwiseOperator
Auto Trait Implementations§
impl Freeze for BitwiseOperator
impl RefUnwindSafe for BitwiseOperator
impl Send for BitwiseOperator
impl Sync for BitwiseOperator
impl Unpin for BitwiseOperator
impl UnsafeUnpin for BitwiseOperator
impl UnwindSafe for BitwiseOperator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more