Expand description
Parameter extraction engine for elif.rs
This module provides enhanced parameter extraction with type conversion, validation, and error handling for route parameters.
§Performance Design
The extraction system is designed for optimal performance in request handling:
- One-time validation: Parameters are validated once during
ExtractedParams
creation, not on every access. - Zero-copy access:
get_str()
returns&str
references without allocation. - Efficient type conversion: Only string parsing overhead, no constraint re-checking.
§Usage Pattern
ⓘ
// 1. Route matcher extracts raw parameters (once per request)
let route_match = matcher.resolve(&method, path)?;
// 2. Parameter extractor validates constraints (once per request)
let extractor = extractors.get(&route_match.route_id)?;
let params = extractor.extract_from_params(route_match.params)?;
// 3. Multiple fast parameter accesses (no validation overhead)
let user_id: i64 = params.get("id")?; // Fast: only string->int parsing
let user_name = params.get_str("name")?; // Fast: zero-copy &str access
Structs§
- Extracted
Params - Extracted and validated route parameters
- Parameter
Extractor - Parameter extractor for route patterns
- Typed
Extractor Builder - Builder for creating typed parameter extractors with validation
Enums§
- Extraction
Error - Errors that can occur during parameter extraction and conversion