Skip to main content

VTabFunctionList

Struct VTabFunctionList 

Source
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>

Source

pub fn add<F>( &self, n_args: i32, name: impl Into<Cow<'vtab, str>>, constraint: Option<ConstraintOp>, func: F, )
where F: Fn(&Context, &mut [&mut ValueRef]) -> Result<()> + 'vtab,

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.

Source

pub fn add_method<F>( &self, n_args: i32, name: impl Into<Cow<'vtab, str>>, constraint: Option<ConstraintOp>, func: F, )
where F: Fn(&'vtab T, &Context, &mut [&mut ValueRef]) -> Result<()> + 'vtab,

Add a method to the list.

This function works similarly to add, except the function will receive the virtual table as the first parameter.

Trait Implementations§

Source§

impl<'vtab, T: VTab<'vtab>> Default for VTabFunctionList<'vtab, T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'vtab, T> !Freeze for VTabFunctionList<'vtab, T>

§

impl<'vtab, T> !RefUnwindSafe for VTabFunctionList<'vtab, T>

§

impl<'vtab, T> !Send for VTabFunctionList<'vtab, T>

§

impl<'vtab, T> !Sync for VTabFunctionList<'vtab, T>

§

impl<'vtab, T> Unpin for VTabFunctionList<'vtab, T>

§

impl<'vtab, T> UnsafeUnpin for VTabFunctionList<'vtab, T>

§

impl<'vtab, T> !UnwindSafe for VTabFunctionList<'vtab, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<U, F> FromUserData<U> for F
where F: Default,

Source§

fn from_user_data(_: &U) -> F

Construct a new instance based on the provided user data.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.