spin_sdk::http::conversions

Trait TryFromBody

Source
pub trait TryFromBody {
    type Error: IntoResponse;

    // Required method
    fn try_from_body(body: Vec<u8>) -> Result<Self, Self::Error>
       where Self: Sized;
}
Expand description

A trait for converting from a body or failing

Required Associated Types§

Source

type Error: IntoResponse

The error encountered if conversion fails

Required Methods§

Source

fn try_from_body(body: Vec<u8>) -> Result<Self, Self::Error>
where Self: Sized,

Convert from a body to Self or fail

Implementations on Foreign Types§

Source§

impl TryFromBody for String

Source§

type Error = NonUtf8BodyError

Source§

fn try_from_body(body: Vec<u8>) -> Result<Self, Self::Error>
where Self: Sized,

Source§

impl<T: TryFromBody> TryFromBody for Option<T>

Source§

type Error = <T as TryFromBody>::Error

Source§

fn try_from_body(body: Vec<u8>) -> Result<Self, Self::Error>
where Self: Sized,

Implementors§