Skip to main content

Ctx

Trait Ctx 

Source
pub trait Ctx {
    // Required methods
    fn date_system(&self) -> DateSystem;
    fn now_serial(&self) -> f64;
    fn random(&mut self) -> f64;

    // Provided methods
    fn computed_criterion(
        &mut self,
        _row: usize,
        _col: usize,
        _db: &Array,
        _record: usize,
    ) -> Option<bool> { ... }
    fn has_lambda(&self) -> bool { ... }
    fn call_lambda(&mut self, _arg: Value) -> Option<Value> { ... }
}
Expand description

Services a function may need from the host.

Required Methods§

Source

fn date_system(&self) -> DateSystem

Source

fn now_serial(&self) -> f64

Current local date-time serial.

Source

fn random(&mut self) -> f64

Uniform in [0, 1).

Provided Methods§

Source

fn computed_criterion( &mut self, _row: usize, _col: usize, _db: &Array, _record: usize, ) -> Option<bool>

For the database functions: whether the formula in the criteria cell at (row, col) holds for record (a row of db below its labels). None when that cell holds no formula or the criteria didn’t come from a reference.

Source

fn has_lambda(&self) -> bool

For GROUPBY/PIVOTBY: whether their function argument is a LAMBDA (its value is then not used).

Source

fn call_lambda(&mut self, _arg: Value) -> Option<Value>

Calls that LAMBDA with arg (one group’s values) and returns its single result; None when there is no lambda.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§