Trait splashsurf_lib::Index
source · pub trait Index: Copy + Hash + Integer + Bounded + CheckedAdd + CheckedSub + CheckedMul + SaturatingSub + AddAssign + SubAssign + MulAssign + FromPrimitive + ToPrimitive + NumCast + Default + Debug + Display + Pod + ThreadSafe + 'static {
// Provided methods
fn range(start: Self, end: Self) -> IndexRange<Self> { ... }
fn two() -> Self { ... }
fn to_real<R: Real>(self) -> Option<R> { ... }
fn to_real_unchecked<R: Real>(self) -> R { ... }
fn times(self, n: i32) -> Self { ... }
fn squared(self) -> Self { ... }
fn cubed(self) -> Self { ... }
fn checked_cubed(self) -> Option<Self> { ... }
}
Expand description
Trait that has to be implemented for types to be used as background grid cell indices in the context of the library
Provided Methods§
fn range(start: Self, end: Self) -> IndexRange<Self>
fn two() -> Self
sourcefn to_real<R: Real>(self) -> Option<R>
fn to_real<R: Real>(self) -> Option<R>
Converts this value to the specified 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.
sourcefn to_real_unchecked<R: Real>(self) -> R
fn to_real_unchecked<R: Real>(self) -> R
Converts this value to the specified Real
type, panics if the value cannot be represented by the target type.
sourcefn times(self, n: i32) -> Self
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.