spin_sdk::http::conversions

Trait TryNonRequestFromRequest

Source
pub trait TryNonRequestFromRequest {
    type Error;

    // Required method
    fn try_from_request(req: Request) -> Result<Self, Self::Error>
       where Self: Sized;
}
Expand description

A hack that allows us to do blanket impls for T where T: TryFromRequest for all types T except for Request.

This is useful in wasi_http where we want to implement TryFromIncomingRequest for all types that impl TryFromRequest with the exception of Request itself. This allows that implementation to first convert the IncomingRequest to a Request and then using this trait convert from Request to the given type.

Required Associated Types§

Source

type Error

The error if the conversion fails

Required Methods§

Source

fn try_from_request(req: Request) -> Result<Self, Self::Error>
where Self: Sized,

Try to turn the request into the type

Implementations on Foreign Types§

Source§

impl<B: TryFromBody> TryNonRequestFromRequest for Request<B>

Implementors§