Trait GenNum

Source
pub trait GenNum<E: BaseNum>:
    Copy
    + Sized
    + Clone
    + One
    + Zero
    + Div<Self, Output = Self>
    + Rem<Self, Output = Self>
    + Add<E, Output = Self>
    + Mul<E, Output = Self>
    + Rand {
    // Required methods
    fn from_s(x: E) -> Self;
    fn map<F>(self, f: F) -> Self
       where F: Fn(E) -> E;
    fn zip<F>(self, y: Self, f: F) -> Self
       where F: Fn(E, E) -> E;
    fn split<F>(self, f: F) -> (Self, Self)
       where F: Fn(E) -> (E, E);
    fn map2<F>(self, y: Self, f: F) -> (Self, Self)
       where F: Fn(E, E) -> (E, E);
}
Expand description

Generic numeric type.

Required Methods§

Source

fn from_s(x: E) -> Self

Constructs from a scalar number.

Source

fn map<F>(self, f: F) -> Self
where F: Fn(E) -> E,

Source

fn zip<F>(self, y: Self, f: F) -> Self
where F: Fn(E, E) -> E,

Source

fn split<F>(self, f: F) -> (Self, Self)
where F: Fn(E) -> (E, E),

Source

fn map2<F>(self, y: Self, f: F) -> (Self, Self)
where F: Fn(E, E) -> (E, E),

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl GenNum<f32> for f32

Source§

fn from_s(x: f32) -> Self

Source§

fn map<F: Fn(f32) -> f32>(self, f: F) -> f32

Source§

fn zip<F: Fn(f32, f32) -> f32>(self, y: f32, f: F) -> f32

Source§

fn split<F: Fn(f32) -> (f32, f32)>(self, f: F) -> (f32, f32)

Source§

fn map2<F: Fn(f32, f32) -> (f32, f32)>(self, y: f32, f: F) -> (f32, f32)

Source§

impl GenNum<f64> for f64

Source§

fn from_s(x: f64) -> Self

Source§

fn map<F: Fn(f64) -> f64>(self, f: F) -> f64

Source§

fn zip<F: Fn(f64, f64) -> f64>(self, y: f64, f: F) -> f64

Source§

fn split<F: Fn(f64) -> (f64, f64)>(self, f: F) -> (f64, f64)

Source§

fn map2<F: Fn(f64, f64) -> (f64, f64)>(self, y: f64, f: F) -> (f64, f64)

Source§

impl GenNum<i32> for i32

Source§

fn from_s(x: i32) -> Self

Source§

fn map<F: Fn(i32) -> i32>(self, f: F) -> i32

Source§

fn zip<F: Fn(i32, i32) -> i32>(self, y: i32, f: F) -> i32

Source§

fn split<F: Fn(i32) -> (i32, i32)>(self, f: F) -> (i32, i32)

Source§

fn map2<F: Fn(i32, i32) -> (i32, i32)>(self, y: i32, f: F) -> (i32, i32)

Source§

impl GenNum<u32> for u32

Source§

fn from_s(x: u32) -> Self

Source§

fn map<F: Fn(u32) -> u32>(self, f: F) -> u32

Source§

fn zip<F: Fn(u32, u32) -> u32>(self, y: u32, f: F) -> u32

Source§

fn split<F: Fn(u32) -> (u32, u32)>(self, f: F) -> (u32, u32)

Source§

fn map2<F: Fn(u32, u32) -> (u32, u32)>(self, y: u32, f: F) -> (u32, u32)

Implementors§

Source§

impl<T: BaseNum> GenNum<T> for Vector2<T>

Source§

impl<T: BaseNum> GenNum<T> for Vector3<T>

Source§

impl<T: BaseNum> GenNum<T> for Vector4<T>