Skip to main content

Params

Trait Params 

Source
pub trait Params: Sized {
    // Required methods
    fn params() -> Vec<ParamInfo>;
    fn take_from(
        kind: &str,
        m: &mut Map<String, Json>,
        params: &[ParamInfo],
    ) -> Result<Self>;

    // Provided method
    fn parse(kind: &str, v: Json) -> Result<Self> { ... }
}
Expand description

The parameters of a block, declared with block_params!.

Required Methods§

Source

fn params() -> Vec<ParamInfo>

The documentation of every parameter.

Source

fn take_from( kind: &str, m: &mut Map<String, Json>, params: &[ParamInfo], ) -> Result<Self>

Take the parameters from the mapping m of a block whose parameters are params (these among them): the parser of a group of parameters shared by several blocks (a [flatten] field of block_params!), whose unknown names mapping rejected against the parameters of the whole block.

§Errors

As Params::parse.

Provided Methods§

Source

fn parse(kind: &str, v: Json) -> Result<Self>

Read the parameters of a block of type kind (a JSON mapping).

§Errors

Error::Config for an unknown parameter, a missing one, a value of the wrong type, out of its bounds or not among its accepted values.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§