Struct arithmetic_eval::fns::Array
source · pub struct Array;
Expand description
Function generating an array by mapping its indexes.
§Type
(using arithmetic-typing
notation)
(Num, (Num) -> 'T) -> ['T]
§Examples
let program = "array(3, |i| 2 * i + 1) == (1, 3, 5)";
let program = Untyped::<F32Grammar>::parse_statements(program)?;
let module = ExecutableModule::new("test_array", &program)?;
let mut env = Environment::new();
env.insert_native_fn("array", fns::Array);
assert_eq!(module.with_env(&env)?.run()?, Value::Bool(true));
Trait Implementations§
source§impl<T> NativeFn<T> for Array
impl<T> NativeFn<T> for Array
source§fn evaluate<'a>(
&self,
args: Vec<SpannedValue<T>>,
ctx: &mut CallContext<'_, T>,
) -> EvalResult<T>
fn evaluate<'a>( &self, args: Vec<SpannedValue<T>>, ctx: &mut CallContext<'_, T>, ) -> EvalResult<T>
Executes the function on the specified arguments.
impl Copy for Array
Auto Trait Implementations§
impl Freeze for Array
impl RefUnwindSafe for Array
impl Send for Array
impl Sync for Array
impl Unpin for Array
impl UnwindSafe for Array
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
)