pub struct VTabFunctionList<'vtab, T: VTab<'vtab>> { /* private fields */ }Expand description
A collection of methods overloaded by a virtual table.
This object is responsible for storing the data associated with overloaded functions. All functions stored in the list must last for the entire lifetime of the virtual table.
Implementations§
Source§impl<'vtab, T: VTab<'vtab> + 'vtab> VTabFunctionList<'vtab, T>
impl<'vtab, T: VTab<'vtab> + 'vtab> VTabFunctionList<'vtab, T>
Sourcepub fn add<F>(
&self,
n_args: i32,
name: impl Into<Cow<'vtab, str>>,
constraint: Option<ConstraintOp>,
func: F,
)
pub fn add<F>( &self, n_args: i32, name: impl Into<Cow<'vtab, str>>, constraint: Option<ConstraintOp>, func: F, )
Add a scalar function to the list.
This method adds a function with the given name and n_args to the list of overloaded functions. Note that when looking for applicable overloads, a function with the correct n_args value will be selected before a function with n_args of -1.
A constraint may be provided. If it is, then the constraint will be provided as an IndexInfoConstraint to VTab::best_index.
The function and all closed variables must live for the duration of the virtual table.
Sourcepub fn add_method<F>(
&self,
n_args: i32,
name: impl Into<Cow<'vtab, str>>,
constraint: Option<ConstraintOp>,
func: F,
)
pub fn add_method<F>( &self, n_args: i32, name: impl Into<Cow<'vtab, str>>, constraint: Option<ConstraintOp>, func: F, )
Add a method to the list.
This function works similarly to add, except the function will receive the virtual table as the first parameter.