Trait splashsurf_lib::Real [−][src]
pub trait Real: RealField + FromPrimitive + ToPrimitive + Debug + Default + Pod + ThreadSafe {
fn try_convert<T: Real>(self) -> Option<T> { ... }
fn try_convert_vec_from<R, const D: usize>(
vec: &SVector<R, D>
) -> Option<SVector<Self, D>>
where
R: Real,
{ ... }
fn to_index<I: Index>(self) -> Option<I> { ... }
fn to_index_unchecked<I: Index>(self) -> I { ... }
fn times(self, n: i32) -> Self { ... }
fn times_f64(self, x: f64) -> Self { ... }
}
Expand description
Trait that has to be implemented for types to be used as floating points values in the context of the library (e.g. for coordinates, density values)
Provided methods
fn try_convert<T: Real>(self) -> Option<T>
fn try_convert<T: Real>(self) -> Option<T>
Tries to convert this value to another Real
type T
by converting first to f64
followed by T::from_f64
. If the value cannot be represented by the target type, None
is returned.
Tries to convert the values of a statically sized nalgebra::SVector
to another type, same behavior as Real::try_convert
Converts this value to the specified Index
type. If the value cannot be represented by the target type, None
is returned.
fn to_index_unchecked<I: Index>(self) -> I
fn to_index_unchecked<I: Index>(self) -> I
Converts this value to the specified Index
type, panics if the value cannot be represented by the target type.
Multiplies this value by the specified i32
coefficient. Panics if the coefficient cannot be converted into the target type.