Trait QueryKeyValue

Source
pub trait QueryKeyValue {
    type Err;
    type UserState;

    // Required methods
    fn from_key_value(
        user_state: &Self::UserState,
        key: &str,
        value: String,
    ) -> Result<Self, Self::Err>
       where Self: Sized;
    fn from_value(
        user_state: &Self::UserState,
        value: String,
    ) -> Result<Self, Self::Err>
       where Self: Sized;
    fn to_key_and_value(&self) -> (&str, &str)
       where Self: Sized;
}
Expand description

The trait, implemented by the Queryable::KeyValue types.

Required Associated Types§

Source

type Err

The Error that is returned when trying to construct an QueryKeyValue from a string.

Source

type UserState

A general state value that is inserted into each from_* call. It can be used to track user state between these calls.

Set this to [()] if you do not need this.

Required Methods§

Source

fn from_key_value( user_state: &Self::UserState, key: &str, value: String, ) -> Result<Self, Self::Err>
where Self: Sized,

Construct this QueryKeyValue from a key name and a value.

§Errors

If value is not a correct value for the key key.

Source

fn from_value( user_state: &Self::UserState, value: String, ) -> Result<Self, Self::Err>
where Self: Sized,

Construct this QueryKeyValue only from a value using the default key.

§Errors

If value is not a correct value for the default key.

Source

fn to_key_and_value(&self) -> (&str, &str)
where Self: Sized,

Split this QueryKeyValue into it’s key and value parts.

This is used to print a Query in it’s normalized from.

Implementors§