Skip to main content

Unary

Trait Unary 

Source
pub unsafe trait Unary<T>: Results<T, 1> + Sync {
    // Required methods
    fn one(&self, x: T) -> Self::Out;
    fn judged(&self, x: T) -> (Self::Out, bool);
    fn slice(
        &self,
        args: [Arg<'_, T>; 1],
        n: usize,
        out: &mut [MaybeUninit<Self::Out>],
    ) -> bool;

    // Provided methods
    fn checked(&self, x: T) -> Option<Self::Out> { ... }
    fn many(&self, x: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>) -> bool
       where T: Copy + Sync { ... }
    fn many_into(
        &self,
        x: Arg<'_, T>,
        n: usize,
        out: &mut Slots<'_, Self::Out>,
    ) -> bool
       where T: Copy { ... }
}
Expand description

A function of one item as a value, with a scalar form and a slice form. rustymath’s function objects, such as Exp, implement it at each item type they take: every Float type for a float function, and complex numbers, integers or Booleans for others. Out is the type of each result, which is the item type unless the function gives another, as Abs gives the real magnitude of a complex number. Its methods take &self, so a function object can hold settings.

§Safety

The slice body initializes every slot in its output before returning.

Required Methods§

Source

fn one(&self, x: T) -> Self::Out

Source

fn judged(&self, x: T) -> (Self::Out, bool)

Source

fn slice( &self, args: [Arg<'_, T>; 1], n: usize, out: &mut [MaybeUninit<Self::Out>], ) -> bool

Provided Methods§

Source

fn checked(&self, x: T) -> Option<Self::Out>

Source

fn many(&self, x: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>) -> bool
where T: Copy + Sync,

Source

fn many_into( &self, x: Arg<'_, T>, n: usize, out: &mut Slots<'_, Self::Out>, ) -> bool
where T: Copy,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Unary<Complex<f32>> for Ceil

Source§

impl Unary<Complex<f32>> for Floor

Source§

impl Unary<Complex<f64>> for Ceil

Source§

impl Unary<Complex<f64>> for Floor

Source§

impl Unary<f16> for Atan

Source§

impl Unary<f16> for Cdf

Source§

impl Unary<f16> for Ceil

Source§

impl Unary<f16> for Erfc

Source§

impl Unary<f16> for Erfcinv

Source§

impl Unary<f16> for Erfinv

Source§

impl Unary<f16> for Floor

Source§

impl Unary<f16> for Ln

Source§

impl Unary<f16> for Log2

Source§

impl Unary<f16> for Log1p

Source§

impl Unary<f16> for Log10

Source§

impl Unary<f16> for Pdf

Source§

impl Unary<f16> for Quantile

Source§

impl Unary<f32> for Atan

Source§

impl Unary<f32> for Cdf

Source§

impl Unary<f32> for Ceil

Source§

impl Unary<f32> for Erfc

Source§

impl Unary<f32> for Erfcinv

Source§

impl Unary<f32> for Erfinv

Source§

impl Unary<f32> for Floor

Source§

impl Unary<f32> for Ln

Source§

impl Unary<f32> for Log2

Source§

impl Unary<f32> for Log1p

Source§

impl Unary<f32> for Log10

Source§

impl Unary<f32> for Pdf

Source§

impl Unary<f32> for Quantile

Source§

impl Unary<f64> for Atan

Source§

impl Unary<f64> for Cdf

Source§

impl Unary<f64> for Ceil

Source§

impl Unary<f64> for Erfc

Source§

impl Unary<f64> for Erfcinv

Source§

impl Unary<f64> for Erfinv

Source§

impl Unary<f64> for Floor

Source§

impl Unary<f64> for Ln

Source§

impl Unary<f64> for Log2

Source§

impl Unary<f64> for Log1p

Source§

impl Unary<f64> for Log10

Source§

impl Unary<f64> for Pdf

Source§

impl Unary<f64> for Quantile

Source§

impl<T: KernelItem, K: Unary<T>> Unary<T> for Wrapped<K>