std::bitwise
Protocols for the bitwise operators: &&&, |||, ^^^, prefix ~~~,
<<< and >>>. Int implements all six; Byte implements the four that
keep a value within 8 bits, and no shift.
Import with import std::bitwise.
Exports
Section titled “Exports”interface BitwiseAnd
Section titled “interface BitwiseAnd”interface BitwiseAnd<Rhs, Out> fn bitwise_and(lhs: self, rhs: Rhs) -> Out end
Protocol for the &&& operator, bitwise and.
BitwiseAnd.bitwise_and(lhs, rhs) returns the result of lhs &&& rhs.
The left-hand type is the implementor (self); the interface type
parameters describe the right-hand operand and the output type, as
Add’s do.
pub type Flags Int impl BitwiseAnd<Flags, Flags> for Flags fn bitwise_and(lhs: Flags, rhs: Flags) -> Flags ... end end
BitwiseAnd.bitwise_and
Section titled “BitwiseAnd.bitwise_and”fn bitwise_and(lhs: self, rhs: Rhs) -> Out
interface BitwiseAnd
interface BitwiseOr
Section titled “interface BitwiseOr”interface BitwiseOr<Rhs, Out> fn bitwise_or(lhs: self, rhs: Rhs) -> Out end
Protocol for the ||| operator, bitwise or. See BitwiseAnd.
BitwiseOr.bitwise_or
Section titled “BitwiseOr.bitwise_or”fn bitwise_or(lhs: self, rhs: Rhs) -> Out
interface BitwiseOr
interface BitwiseXor
Section titled “interface BitwiseXor”interface BitwiseXor<Rhs, Out> fn bitwise_xor(lhs: self, rhs: Rhs) -> Out end
Protocol for the ^^^ operator, bitwise exclusive or. See BitwiseAnd.
BitwiseXor.bitwise_xor
Section titled “BitwiseXor.bitwise_xor”fn bitwise_xor(lhs: self, rhs: Rhs) -> Out
interface BitwiseXor
interface BitwiseNot
Section titled “interface BitwiseNot”interface BitwiseNot<Out> fn bitwise_not(value: self) -> Out end
Protocol for the prefix ~~~ operator, bitwise not. The operand is the
implementor (self); the type parameter is the result type.
BitwiseNot.bitwise_not
Section titled “BitwiseNot.bitwise_not”fn bitwise_not(value: self) -> Out
interface BitwiseNot
interface ShiftLeft
Section titled “interface ShiftLeft”interface ShiftLeft<Rhs, Out> fn shift_left(lhs: self, rhs: Rhs) -> Out end
Protocol for the <<< operator, shift left. See BitwiseAnd.
ShiftLeft.shift_left
Section titled “ShiftLeft.shift_left”fn shift_left(lhs: self, rhs: Rhs) -> Out
interface ShiftLeft
interface ShiftRight
Section titled “interface ShiftRight”interface ShiftRight<Rhs, Out> fn shift_right(lhs: self, rhs: Rhs) -> Out end
Protocol for the >>> operator, arithmetic shift right. See
BitwiseAnd.
ShiftRight.shift_right
Section titled “ShiftRight.shift_right”fn shift_right(lhs: self, rhs: Rhs) -> Out
interface ShiftRight