pub trait Real:
RealByValue
+ for<'a> RealByValue<&'a Self>
+ Pi
+ Numeric { }
Expand description
A general purpose extension to the numeric trait that adds many operations needed for more complex math operations.
This trait extends the constraints in RealByValue to types which also support the operations with a right hand side type by reference, and adds some additional constraints needed only by value on types.
When used together with RealRef this expresses all 4 by value and by reference combinations for the operations using the following syntax:
fn function_name<T: Real>()
where for<'a> &'a T: RealRef<T> {
}
This pair of constraints is used where any real number type is needed, so although this trait does not require reference type methods by itself, in practise you won’t be able to call many functions in this library with a real type that doesn’t.
In version 2.0 of Easy ML it now inherits from Numeric directly, old code depending on a previous version of Easy ML that also specified the Numeric traits such as:
fn function_name<T: Numeric + Real>()
where for<'a> &'a T: NumericRef<T> + RealRef<T> {
}
can be updated when using Easy ML 2.0 or later to the following:
fn function_name<T: Real>()
where for<'a> &'a T: RealRef<T> {
}
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.