Type Alias arithmetic_eval::fns::Unary

source ·
pub type Unary<T> = FnWrapper<(T, T), fn(_: T) -> T>;
Expand description

Unary function wrapper.

Aliased Type§

struct Unary<T> { /* private fields */ }

Implementations§

source§

impl<T, F, const CTX: bool> FnWrapper<T, F, CTX>

source

pub const fn new(function: F) -> Self

Creates a new wrapper.

Note that the created wrapper is not guaranteed to be usable as NativeFn. For this to be the case, function needs to be a function or an Fn closure, and the T type argument needs to be a tuple with the function return type and the argument types (in this order).

Trait Implementations§

source§

impl<T, F: Clone, const CTX: bool> Clone for FnWrapper<T, F, CTX>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T, F, const CTX: bool> Debug for FnWrapper<T, F, CTX>where F: Debug,

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Num, F, Ret, T> NativeFn<Num> for FnWrapper<(Ret, T), F, false>where F: Fn(T) -> Ret, T: TryFromValue<Num>, Ret: IntoEvalResult<Num>,

source§

fn evaluate( &self, args: Vec<SpannedValue<Num>>, context: &mut CallContext<'_, Num> ) -> EvalResult<Num>

Executes the function on the specified arguments.
source§

impl<T, F: Copy, const CTX: bool> Copy for FnWrapper<T, F, CTX>