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§
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
fn many_into(
&self,
x: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".