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§
sourcefn to_index<I: Index>(self) -> Option<I>
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.
sourcefn 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.