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§

source

fn range(start: Self, end: Self) -> IndexRange<Self>

source

fn two() -> Self

source

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.

source

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.

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 squared(self) -> Self

Returns the squared value of this value.

source

fn cubed(self) -> Self

Returns the cubed value of this value.

source

fn checked_cubed(self) -> Option<Self>

Implementors§