Trait FromServerFnError

pub trait FromServerFnError:
    Sized
    + Debug
    + 'static {
    type Encoder: Encodes<Self> + Decodes<Self>;

    // Required method
    fn from_server_fn_error(value: ServerFnErrorErr) -> Self;

    // Provided methods
    fn ser(&self) -> Bytes { ... }
    fn de(data: Bytes) -> Self { ... }
}
Expand description

A trait for types that can be returned from a server function.

Required Associated Types§

type Encoder: Encodes<Self> + Decodes<Self>

The encoding strategy used to serialize and deserialize this error type. Must implement the Encodes trait for references to the error type.

Required Methods§

fn from_server_fn_error(value: ServerFnErrorErr) -> Self

Converts a ServerFnErrorErr into the application-specific custom error type.

Provided Methods§

fn ser(&self) -> Bytes

Converts the custom error type to a String.

fn de(data: Bytes) -> Self

Deserializes the custom error type from a &str.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl<CustErr> FromServerFnError for ServerFnError<CustErr>
where CustErr: Debug + Display + FromStr + 'static,