Module extraction

Module extraction 

Source
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:

  1. One-time validation: Parameters are validated once during ExtractedParams creation, not on every access.
  2. Zero-copy access: get_str() returns &str references without allocation.
  3. 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§

ExtractedParams
Extracted and validated route parameters
ParameterExtractor
Parameter extractor for route patterns
TypedExtractorBuilder
Builder for creating typed parameter extractors with validation

Enums§

ExtractionError
Errors that can occur during parameter extraction and conversion