pub struct Params(/* private fields */);Expand description
Route parameters captured while matching, in pattern order.
Implementations§
Source§impl Params
impl Params
pub fn new() -> Params
Sourcepub fn with(
self,
name: impl Into<String>,
value: impl Into<ParamValue>,
) -> Params
pub fn with( self, name: impl Into<String>, value: impl Into<ParamValue>, ) -> Params
Builder helper: Params::new().with("slug", "hello").
pub fn insert(&mut self, name: impl Into<String>, value: impl Into<ParamValue>)
Sourcepub fn get(&self, name: &str) -> Option<&str>
pub fn get(&self, name: &str) -> Option<&str>
Single-segment value. For catch-all params this returns the segments
joined by /… use Params::get_all to obtain them individually.
Sourcepub fn get_all(&self, name: &str) -> Option<&[String]>
pub fn get_all(&self, name: &str) -> Option<&[String]>
Catch-all segments ([...slug]). A single [id] value is returned as
a one element slice.
pub fn value(&self, name: &str) -> Option<&ParamValue>
pub fn iter(&self) -> impl Iterator<Item = (&str, &ParamValue)>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Params
impl<'de> Deserialize<'de> for Params
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Params, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Params, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Params
Source§impl FromContext for Params
impl FromContext for Params
fn from_context(ctx: &Arc<RequestContext>) -> Result<Params, Error>
Source§impl<K, V> FromIterator<(K, V)> for Params
impl<K, V> FromIterator<(K, V)> for Params
Source§impl Serialize for Params
impl Serialize for Params
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Params
Auto Trait Implementations§
impl Forget for Params
impl Freeze for Params
impl Move for Params
impl RefUnwindSafe for Params
impl Send for Params
impl Sync for Params
impl Unpin for Params
impl UnsafeUnpin for Params
impl UnwindSafe for Params
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.