pub fn optional<T>() -> Optional<T>where
T: DeserializeOwned + 'static,Expand description
Create an endpoint which parses the query string to the specified type.
This endpoint always matches and returns a None if the query string is missing.
ยงExample
#[derive(Debug, Deserialize)]
pub struct Param {
query: String,
count: Option<u32>,
}
let endpoint = query::optional()
.map(|param: Option<Param>| {
format!("Received: {:?}", param)
});