Skip to main content

CustomCallable

Trait CustomCallable 

Source
pub trait CustomCallable: Send + Sync {
    // Required methods
    fn arity(&self) -> usize;
    fn invoke<'ctx>(
        &self,
        interp: &Interpreter<'ctx>,
        args: &[LiteralValue],
    ) -> Result<CalcValue<'ctx>, ExcelError>;

    // Provided method
    fn invoke_with_references<'ctx>(
        &self,
        interp: &Interpreter<'ctx>,
        args: &[LiteralValue],
        references: &[Option<ReferenceType>],
    ) -> Result<CalcValue<'ctx>, ExcelError> { ... }
}

Required Methods§

Source

fn arity(&self) -> usize

Source

fn invoke<'ctx>( &self, interp: &Interpreter<'ctx>, args: &[LiteralValue], ) -> Result<CalcValue<'ctx>, ExcelError>

Provided Methods§

Source

fn invoke_with_references<'ctx>( &self, interp: &Interpreter<'ctx>, args: &[LiteralValue], references: &[Option<ReferenceType>], ) -> Result<CalcValue<'ctx>, ExcelError>

Invoke with each argument’s optional bound reference alongside the already-materialized values.

references[i] is the spreadsheet reference argument i was written as, when it was written as one; None otherwise, and a short slice is read as None for every missing position. A callable that binds its arguments to locals uses this to bind a range-valued parameter as crate::interpreter::LocalBinding::ValueWithReference, so a by-ref argument slot inside the body sees the range rather than a lifted array.

Defaults to Self::invoke, so an implementor that does not care about references needs no change.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§