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§
Sourcetype Err
type Err
The Error that is returned when trying to construct an QueryKeyValue
from a string.
Required Methods§
Sourcefn from_key_value(
user_state: &Self::UserState,
key: &str,
value: String,
) -> Result<Self, Self::Err>where
Self: Sized,
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.
Sourcefn from_value(
user_state: &Self::UserState,
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,
Construct this QueryKeyValue only from a value using the default
key.
§Errors
If value is not a correct value for the default key.
Sourcefn to_key_and_value(&self) -> (&str, &str)where
Self: Sized,
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.