pub trait FromCall: Sized + Send {
// Required method
fn from_call<'async_trait>(
call: Call,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where Self: 'async_trait;
}Expand description
Extract a value by consuming the whole Call.
Because it takes the Call by value, a FromCall extractor may appear only
as the last handler argument. Body-consuming extractors (such as a JSON
body) implement this directly. Every FromCallParts type is automatically
a FromCall via a blanket impl, and Call itself is FromCall (so a
|c: Call| handler is just the last-argument case).
use churust_core::{Call, FromCall};
use http::{HeaderMap, Method};
use bytes::Bytes;
let c = Call::new(Method::GET, "/".parse().unwrap(), HeaderMap::new(), Bytes::new());
// `Call` is itself a `FromCall`:
let back = Call::from_call(c).await.unwrap();
assert_eq!(back.method(), &Method::GET);Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".