[][src]Trait easy_ml::numeric::NumericRef

pub trait NumericRef<T>: NumericByValue<T, T> + for<'a> NumericByValue<&'a T, T> { }

The trait to define &T op T and &T op &T versions for NumericByValue based off the MIT/Apache 2.0 licensed code from num-traits 0.2.10:

This trait is not ever used directly for users of this library. You don't need to deal with it unless implementing custom numeric types and even then it will be implemented automatically.

  • http://opensource.org/licenses/MIT
  • https://docs.rs/num-traits/0.2.10/src/num_traits/lib.rs.html#112

The trick is that all types implementing this trait will be references, so the first constraint expresses some &T which can be operated on with some right hand side type T to yield a value of type T.

In a similar way the second constraint expresses &T op &T -> T operations

Implementors

impl<RefT, T> NumericRef<T> for RefT where
    RefT: NumericByValue<T, T> + for<'a> NumericByValue<&'a T, T>, 
[src]

Anything which implements all the super traits will automatically implement this trait too. This covers primitives such as &f32, &f64, ie a type like &u8 is NumericRef<u8>.

Loading content...