pub trait Extractor<State> {
type Error: Into<ExtractorError>;
// Required method
fn extract(
frame: Frame,
context: &Context<State>,
) -> Result<Self, Self::Error>
where Self: Sized;
// Provided method
fn extract_from_frame_and_state(
frame: Frame,
context: &Context<State>,
) -> Result<Self>
where Self: Sized,
Self::Error: Into<ExtractorError> { ... }
}
Expand description
Implement extract to allow for extracting values from an action.
Required Associated Types§
Sourcetype Error: Into<ExtractorError>
type Error: Into<ExtractorError>
The error type for this extractor. Anything that can be converted into an extractor error can be used as an error type.
Types that can be converted into an extractor error are:
String
Infallible
tower::BoxError
Required Methods§
Provided Methods§
Sourcefn extract_from_frame_and_state(
frame: Frame,
context: &Context<State>,
) -> Result<Self>
fn extract_from_frame_and_state( frame: Frame, context: &Context<State>, ) -> Result<Self>
Extract a value from a frame and state, returning a result containing the extracted value
or an error coerced into a crate::Error
.