Trait fizyr_rpc::Body

source ·
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§

source

fn empty() -> Self

Create an empty message body.

source

fn from_error(message: &str) -> Self

Create a message body from an error message.

source

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.

source

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.

Implementors§