pub struct ExtractedParams { /* private fields */ }
Expand description
Extracted and validated route parameters
Implementations§
Source§impl ExtractedParams
impl ExtractedParams
Sourcepub fn from_route_match(
raw_params: HashMap<String, String>,
pattern: RoutePattern,
) -> Result<Self, ExtractionError>
pub fn from_route_match( raw_params: HashMap<String, String>, pattern: RoutePattern, ) -> Result<Self, ExtractionError>
Create new extracted parameters from RouteMatch with validation
Sourcepub fn get<T>(&self, name: &str) -> Result<T, ExtractionError>
pub fn get<T>(&self, name: &str) -> Result<T, ExtractionError>
Get a parameter converted to a specific type
Note: Parameters are pre-validated during ExtractedParams creation, so this method only handles type conversion.
Sourcepub fn get_int(&self, name: &str) -> Result<i64, ExtractionError>
pub fn get_int(&self, name: &str) -> Result<i64, ExtractionError>
Get a parameter as an integer
Sourcepub fn get_or<T>(&self, name: &str, default: T) -> Result<T, ExtractionError>
pub fn get_or<T>(&self, name: &str, default: T) -> Result<T, ExtractionError>
Get a parameter with a default value if missing
Sourcepub fn get_optional<T>(&self, name: &str) -> Result<Option<T>, ExtractionError>
pub fn get_optional<T>(&self, name: &str) -> Result<Option<T>, ExtractionError>
Get a parameter as an Option (None if missing)
Sourcepub fn param_names(&self) -> Vec<&String>
pub fn param_names(&self) -> Vec<&String>
Get all parameter names
Sourcepub fn raw_params(&self) -> &HashMap<String, String>
pub fn raw_params(&self) -> &HashMap<String, String>
Get all raw parameter values
Sourcepub fn validate_all(&self) -> Result<(), ExtractionError>
pub fn validate_all(&self) -> Result<(), ExtractionError>
Validate all parameters against their constraints
Trait Implementations§
Source§impl Clone for ExtractedParams
impl Clone for ExtractedParams
Source§fn clone(&self) -> ExtractedParams
fn clone(&self) -> ExtractedParams
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 moreAuto Trait Implementations§
impl Freeze for ExtractedParams
impl RefUnwindSafe for ExtractedParams
impl Send for ExtractedParams
impl Sync for ExtractedParams
impl Unpin for ExtractedParams
impl UnwindSafe for ExtractedParams
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