Skip to main content

QueryFn

Trait QueryFn 

Source
pub trait QueryFn<P: Package, Args, R> {
    // Required methods
    fn arg_types() -> Vec<Ty>;
    fn ret_ty() -> Ty;
    fn call(
        &self,
        ctx: &Ctx<'_, P>,
        args: &[Value],
    ) -> Result<Value, CommandError>;
}
Expand description

The function of a query command (Fn(&Ctx<P>, args...) -> R; 0 to 6 arguments).

Required Methods§

Source

fn arg_types() -> Vec<Ty>

The argument types.

Source

fn ret_ty() -> Ty

The return type.

Source

fn call(&self, ctx: &Ctx<'_, P>, args: &[Value]) -> Result<Value, CommandError>

Calls it.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<P: Package, F, R, A1, A2, A3, A4, A5, A6> QueryFn<P, (A1, A2, A3, A4, A5, A6), R> for F
where F: Fn(&Ctx<'_, P>, A1, A2, A3, A4, A5, A6) -> R, R: IntoReturn, A1: FromValue, A2: FromValue, A3: FromValue, A4: FromValue, A5: FromValue, A6: FromValue,

Source§

impl<P: Package, F, R, A1, A2, A3, A4, A5> QueryFn<P, (A1, A2, A3, A4, A5), R> for F
where F: Fn(&Ctx<'_, P>, A1, A2, A3, A4, A5) -> R, R: IntoReturn, A1: FromValue, A2: FromValue, A3: FromValue, A4: FromValue, A5: FromValue,

Source§

impl<P: Package, F, R, A1, A2, A3, A4> QueryFn<P, (A1, A2, A3, A4), R> for F
where F: Fn(&Ctx<'_, P>, A1, A2, A3, A4) -> R, R: IntoReturn, A1: FromValue, A2: FromValue, A3: FromValue, A4: FromValue,

Source§

impl<P: Package, F, R, A1, A2, A3> QueryFn<P, (A1, A2, A3), R> for F
where F: Fn(&Ctx<'_, P>, A1, A2, A3) -> R, R: IntoReturn, A1: FromValue, A2: FromValue, A3: FromValue,

Source§

impl<P: Package, F, R, A1, A2> QueryFn<P, (A1, A2), R> for F
where F: Fn(&Ctx<'_, P>, A1, A2) -> R, R: IntoReturn, A1: FromValue, A2: FromValue,

Source§

impl<P: Package, F, R, A1> QueryFn<P, (A1,), R> for F
where F: Fn(&Ctx<'_, P>, A1) -> R, R: IntoReturn, A1: FromValue,

Source§

impl<P: Package, F, R> QueryFn<P, (), R> for F
where F: Fn(&Ctx<'_, P>) -> R, R: IntoReturn,