pub trait Body: Send + Sync + Sized + 'static {
// Required methods
fn empty() -> Self;
fn from_error(message: &str) -> Self;
fn as_error(&self) -> Result<&str, Utf8Error>;
fn into_error(self) -> Result<String, FromUtf8Error>;
}
Expand description
Trait for types that can be used as message body.
Required Methods§
sourcefn from_error(message: &str) -> Self
fn from_error(message: &str) -> Self
Create a message body from an error message.
sourcefn as_error(&self) -> Result<&str, Utf8Error>
fn as_error(&self) -> Result<&str, Utf8Error>
Interpret a body as error message.
You should only call this if you know that the body represent an error message.
sourcefn into_error(self) -> Result<String, FromUtf8Error>
fn into_error(self) -> Result<String, FromUtf8Error>
Interpret a body as error message.
You should only call this if you know that the body represent an error message.
Object Safety§
This trait is not object safe.