Params

Trait Params 

Source
pub trait Params<const ARITY: usize>: HasLotusJson {
    // Required methods
    fn schemas(g: &mut SchemaGenerator) -> [(Schema, bool); ARITY];
    fn parse(
        raw: Option<RequestParameters>,
        names: [&str; ARITY],
        calling_convention: ParamStructure,
        n_required: usize,
    ) -> Result<Self, Error>
       where Self: Sized;

    // Provided method
    fn unparse(self) -> Result<[Value; ARITY], Error> { ... }
}
Expand description

A tuple of ARITY arguments.

This should NOT be manually implemented.

Required Methods§

Source

fn schemas(g: &mut SchemaGenerator) -> [(Schema, bool); ARITY]

A Schema and Optional::optional schema-nullable pair for argument, in-order.

Source

fn parse( raw: Option<RequestParameters>, names: [&str; ARITY], calling_convention: ParamStructure, n_required: usize, ) -> Result<Self, Error>
where Self: Sized,

Convert from raw request parameters, to the argument tuple required by RpcMethod::handle

Provided Methods§

Source

fn unparse(self) -> Result<[Value; ARITY], Error>

Convert from an argument tuple to un-typed JSON.

Exposes de-serialization errors, or mis-implementation of this trait.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Params<0> for ()

Source§

fn parse( raw: Option<RequestParameters>, arg_names: [&str; 0], calling_convention: ParamStructure, n_required: usize, ) -> Result<Self, Error>

Source§

fn schemas(_gen: &mut SchemaGenerator) -> [(Schema, bool); 0]

Source§

impl<T0> Params<1> for (T0,)

Source§

fn parse( raw: Option<RequestParameters>, arg_names: [&str; 1], calling_convention: ParamStructure, n_required: usize, ) -> Result<Self, Error>

Source§

fn schemas(_gen: &mut SchemaGenerator) -> [(Schema, bool); 1]

Source§

impl<T0, T1> Params<2> for (T0, T1)

Source§

fn parse( raw: Option<RequestParameters>, arg_names: [&str; 2], calling_convention: ParamStructure, n_required: usize, ) -> Result<Self, Error>

Source§

fn schemas(_gen: &mut SchemaGenerator) -> [(Schema, bool); 2]

Source§

impl<T0, T1, T2> Params<3> for (T0, T1, T2)

Source§

fn parse( raw: Option<RequestParameters>, arg_names: [&str; 3], calling_convention: ParamStructure, n_required: usize, ) -> Result<Self, Error>

Source§

fn schemas(_gen: &mut SchemaGenerator) -> [(Schema, bool); 3]

Source§

impl<T0, T1, T2, T3> Params<4> for (T0, T1, T2, T3)

Source§

fn parse( raw: Option<RequestParameters>, arg_names: [&str; 4], calling_convention: ParamStructure, n_required: usize, ) -> Result<Self, Error>

Source§

fn schemas(_gen: &mut SchemaGenerator) -> [(Schema, bool); 4]

Implementors§