pub struct QueryParams { /* private fields */ }Expand description
Parsed query string parameters extracted from the request URI.
Automatically injected into the Bus by HttpIngress for every request.
Use bus.read::<QueryParams>() inside transitions to access query parameters.
§Example
ⓘ
let page = bus.read::<QueryParams>()
.and_then(|q| q.get_parsed::<i64>("page"))
.unwrap_or(1);Implementations§
Source§impl QueryParams
impl QueryParams
Sourcepub fn from_query(query: &str) -> Self
pub fn from_query(query: &str) -> Self
Create QueryParams from a raw query string (e.g. "page=1&limit=20").
Sourcepub fn get_parsed<T: FromStr>(&self, key: &str) -> Option<T>
pub fn get_parsed<T: FromStr>(&self, key: &str) -> Option<T>
Parse a query parameter value as type T.
Returns None if the key is absent or parsing fails.
Trait Implementations§
Source§impl Clone for QueryParams
impl Clone for QueryParams
Source§fn clone(&self) -> QueryParams
fn clone(&self) -> QueryParams
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for QueryParams
impl Debug for QueryParams
Source§impl Default for QueryParams
impl Default for QueryParams
Source§fn default() -> QueryParams
fn default() -> QueryParams
Returns the “default value” for a type. Read more
Source§impl PartialEq for QueryParams
impl PartialEq for QueryParams
impl Eq for QueryParams
impl StructuralPartialEq for QueryParams
Auto Trait Implementations§
impl Freeze for QueryParams
impl RefUnwindSafe for QueryParams
impl Send for QueryParams
impl Sync for QueryParams
impl Unpin for QueryParams
impl UnsafeUnpin for QueryParams
impl UnwindSafe for QueryParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.