pub struct RawPathParams<'server, 'request>(/* private fields */);
Expand description
Extract (raw) path parameters from the URL of an incoming request.
§Guide
Check out the guide for more information on how to use this extractor.
§Example
use pavex::f;
use pavex::blueprint::{router::GET, Blueprint};
use pavex::request::path::RawPathParams;
fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
// [...]
// Register a route with a few path parameters.
bp.route(GET, "/address/:address_id/home/:home_id", f!(crate::get_home));
bp
}
pub fn get_home(params: &RawPathParams) -> String {
let home_id = ¶ms.get("home_id").unwrap();
let street_id = ¶ms.get("street_id").unwrap();
format!("The home with id {} is in street {}", home_id, street_id)
}
Implementations§
source§impl<'server, 'request> RawPathParams<'server, 'request>
impl<'server, 'request> RawPathParams<'server, 'request>
Trait Implementations§
source§impl<'server, 'request> Clone for RawPathParams<'server, 'request>
impl<'server, 'request> Clone for RawPathParams<'server, 'request>
source§fn clone(&self) -> RawPathParams<'server, 'request>
fn clone(&self) -> RawPathParams<'server, 'request>
Returns a copy 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<'server, 'request> Debug for RawPathParams<'server, 'request>
impl<'server, 'request> Debug for RawPathParams<'server, 'request>
source§impl Default for RawPathParams<'_, '_>
impl Default for RawPathParams<'_, '_>
source§impl<'k, 'v> From<Params<'k, 'v>> for RawPathParams<'k, 'v>
impl<'k, 'v> From<Params<'k, 'v>> for RawPathParams<'k, 'v>
source§impl<'server, 'request> PartialEq for RawPathParams<'server, 'request>
impl<'server, 'request> PartialEq for RawPathParams<'server, 'request>
source§fn eq(&self, other: &RawPathParams<'server, 'request>) -> bool
fn eq(&self, other: &RawPathParams<'server, 'request>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.impl<'server, 'request> Eq for RawPathParams<'server, 'request>
impl<'server, 'request> StructuralPartialEq for RawPathParams<'server, 'request>
Auto Trait Implementations§
impl<'server, 'request> Freeze for RawPathParams<'server, 'request>
impl<'server, 'request> RefUnwindSafe for RawPathParams<'server, 'request>
impl<'server, 'request> Send for RawPathParams<'server, 'request>
impl<'server, 'request> Sync for RawPathParams<'server, 'request>
impl<'server, 'request> Unpin for RawPathParams<'server, 'request>
impl<'server, 'request> UnwindSafe for RawPathParams<'server, 'request>
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.