We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e226414 commit fc85f20Copy full SHA for fc85f20
src/querystring.rs
@@ -3,6 +3,21 @@ use http::StatusCode;
3
use serde::Deserialize;
4
5
/// An extension trait for `Context`, providing query string deserialization.
6
+///
7
+/// # Example
8
9
+/// Turning the query parameters into a `HashMap`:
10
11
+/// ```
12
+/// # use std::collections::HashMap;
13
+/// use tide::querystring::ContextExt;
14
15
+/// let mut app = tide::App::new();
16
+/// app.at("/").get(|cx: tide::Context<()>| async move {
17
+/// let map: HashMap<String, String> = cx.url_query().unwrap();
18
+/// format!("{:?}", map)
19
+/// });
20
21
pub trait ContextExt<'de> {
22
fn url_query<T: Deserialize<'de>>(&'de self) -> Result<T, Error>;
23
}
0 commit comments