Trait Binary

Source
pub trait Binary<Lhs, Rhs> {
    type Output;

    // Required method
    fn op(lhs: Lhs, rhs: Rhs) -> Self::Output;

    // Provided method
    fn op_assign(lhs: &mut Lhs, rhs: Rhs)
       where Lhs: Assignable<Self::Output> { ... }
}
Expand description

Trait that represents a binary operation on the left-hand operand of type Lhs and the right-hand operand of type Rhs that returns the result of type Output.

See Async::op and Async::op_assign.

Required Associated Types§

Source

type Output

The resulting type after applying the binary operation.

Required Methods§

Source

fn op(lhs: Lhs, rhs: Rhs) -> Self::Output

Do the binary operation on given operands.

Provided Methods§

Source

fn op_assign(lhs: &mut Lhs, rhs: Rhs)
where Lhs: Assignable<Self::Output>,

Do the binary operation on given operands and assign the result to the lhs operand.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Lhs: Future, Rhs: Future> Binary<Lhs, Rhs> for Add
where Lhs::Output: Add<Rhs::Output>,

Source§

type Output = AsyncAdd<Lhs, Rhs>

Source§

impl<Lhs: Future, Rhs: Future> Binary<Lhs, Rhs> for BitAnd
where Lhs::Output: BitAnd<Rhs::Output>,

Source§

type Output = AsyncBitAnd<Lhs, Rhs>

Source§

impl<Lhs: Future, Rhs: Future> Binary<Lhs, Rhs> for BitOr
where Lhs::Output: BitOr<Rhs::Output>,

Source§

type Output = AsyncBitOr<Lhs, Rhs>

Source§

impl<Lhs: Future, Rhs: Future> Binary<Lhs, Rhs> for BitXor
where Lhs::Output: BitXor<Rhs::Output>,

Source§

type Output = AsyncBitXor<Lhs, Rhs>

Source§

impl<Lhs: Future, Rhs: Future> Binary<Lhs, Rhs> for Div
where Lhs::Output: Div<Rhs::Output>,

Source§

type Output = AsyncDiv<Lhs, Rhs>

Source§

impl<Lhs: Future, Rhs: Future> Binary<Lhs, Rhs> for Mul
where Lhs::Output: Mul<Rhs::Output>,

Source§

type Output = AsyncMul<Lhs, Rhs>

Source§

impl<Lhs: Future, Rhs: Future> Binary<Lhs, Rhs> for Rem
where Lhs::Output: Rem<Rhs::Output>,

Source§

type Output = AsyncRem<Lhs, Rhs>

Source§

impl<Lhs: Future, Rhs: Future> Binary<Lhs, Rhs> for Shl
where Lhs::Output: Shl<Rhs::Output>,

Source§

type Output = AsyncShl<Lhs, Rhs>

Source§

impl<Lhs: Future, Rhs: Future> Binary<Lhs, Rhs> for Shr
where Lhs::Output: Shr<Rhs::Output>,

Source§

type Output = AsyncShr<Lhs, Rhs>

Source§

impl<Lhs: Future, Rhs: Future> Binary<Lhs, Rhs> for Sub
where Lhs::Output: Sub<Rhs::Output>,

Source§

type Output = AsyncSub<Lhs, Rhs>