Trait splashsurf_lib::Real

source ·
pub trait Real: RealField + Bounded + Copy + FromPrimitive + ToPrimitive + NumCast + Debug + Default + Pod + ThreadSafe {
    // Provided methods
    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§

source

fn to_index<I: Index>(self) -> Option<I>

Converts this value to the specified Index type. If the value cannot be represented by the target type, None is returned.

source

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.

source

fn times(self, n: i32) -> Self

Multiplies this value by the specified i32 coefficient. Panics if the coefficient cannot be converted into the target type.

source

fn times_f64(self, x: f64) -> Self

Multiplies this value by the specified f64 coefficient. Panics if the coefficient cannot be converted into the target type.

Implementors§

source§

impl<T: RealField + Bounded + Copy + FromPrimitive + ToPrimitive + NumCast + Debug + Default + Pod + ThreadSafe + 'static> Real for T