pub trait RefMutMul<Rhs = Self>: Sealed<Rhs> {
    type Output;
    // Required method
    fn ref_mut_mul(&mut self, rhs: Rhs) -> Self::Output;
}Expand description
mul operation through mutable references.
As of Rust 1.72.1, the following code does not compile:
ⓘ
use core::ops::Mul;
struct A<T>(T);
impl<'a, 'b, T, U, O> Mul<&'b mut A<U>> for &'a mut A<T>
where
    &'a mut T: Mul<&'b mut U, Output = O>,
{
    type Output = A<O>;
    fn mul(self, rhs: &'b mut A<U>) -> Self::Output {
        A(self.0.mul(&mut rhs.0))
    }
}
fn _f<T, U>(mut a: T, mut b: U)
where
    for<'a, 'b> &'a mut T: Mul<&'b mut U>,
{
    let _a_op_b = (&mut a).mul(&mut b);
    // to do something with `a`, `b`, and `_a_op_b`
}
fn _g<T, U>(a: T, b: U)
where
    for<'a, 'b> &'a mut T: Mul<&'b mut U>,
{
    _f(a, b);
}but the following code does:
use core::ops::Mul;
use ref_ops::RefMutMul;
struct A<T>(T);
impl<'a, T, U> Mul<&'a mut A<U>> for &mut A<T>
where
    T: RefMutMul<&'a mut U>,
{
    type Output = A<T::Output>;
    fn mul(self, rhs: &'a mut A<U>) -> Self::Output {
        A(self.0.ref_mut_mul(&mut rhs.0))
    }
}
fn _f<T, U>(mut a: T, mut b: U)
where
    for<'a, 'b> &'a mut T: Mul<&'b mut U>,
{
    let _a_op_b = (&mut a).mul(&mut b);
    // to do something with `a`, `b`, and `_a_op_b`
}
fn _g<T, U>(a: T, b: U)
where
    for<'a, 'b> &'a mut T: Mul<&'b mut U>,
{
    _f(a, b);
}Required Associated Types§
Required Methods§
sourcefn ref_mut_mul(&mut self, rhs: Rhs) -> Self::Output
 
fn ref_mut_mul(&mut self, rhs: Rhs) -> Self::Output
Performs mul operation.