Trait gotham::router::request::path::PathExtractor
[−]
[src]
pub trait PathExtractor: StaticResponseExtender { fn extract(
state: &mut State,
segment_mapping: SegmentMapping
) -> Result<(), String>; }
Extracts the Request
path into State
. On failure is capable of extending Response
to indicate why the extraction process failed.
This functionality can be simply derived for application structs via PathExtractor
,
which will attempt to populate the associated struct. Combine with the derive
StaticResponseExtender
to have invalid query string data result in "400 Bad Request".
Custom responses can be created by using the PathExtractor
derive and then
implementing StaticResponseExtender
independently.
Required Methods
fn extract(
state: &mut State,
segment_mapping: SegmentMapping
) -> Result<(), String>
state: &mut State,
segment_mapping: SegmentMapping
) -> Result<(), String>
Populates the struct with data from the Request
path and adds it to State
Implementors
impl PathExtractor for NoopPathExtractor