Struct arithmetic_eval::fns::All
source · pub struct All;
Expand description
Function that checks whether all of array items satisfy the provided predicate.
§Type
(using arithmetic-typing
notation)
(['T], ('T) -> Bool) -> Bool
§Examples
let program = "
assert(all((1, 2, 3, 5), |x| x > 0));
assert(!all((1, -2, 3), |x| x > 0));
";
let program = Untyped::<F32Grammar>::parse_statements(program)?;
let module = ExecutableModule::new("test_all", &program)?;
let mut env = Environment::new();
env.insert_native_fn("all", fns::All)
.insert_native_fn("assert", fns::Assert);
module.with_env(&env)?.run()?;
Trait Implementations§
source§impl<T: Clone + 'static> NativeFn<T> for All
impl<T: Clone + 'static> NativeFn<T> for All
source§fn evaluate(
&self,
args: Vec<SpannedValue<T>>,
ctx: &mut CallContext<'_, T>,
) -> EvalResult<T>
fn evaluate( &self, args: Vec<SpannedValue<T>>, ctx: &mut CallContext<'_, T>, ) -> EvalResult<T>
Executes the function on the specified arguments.
impl Copy for All
Auto Trait Implementations§
impl Freeze for All
impl RefUnwindSafe for All
impl Send for All
impl Sync for All
impl Unpin for All
impl UnwindSafe for All
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)