Skip to main content

FromServerFnError

Trait FromServerFnError 

Source
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§

Source

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§

Source

fn from_server_fn_error(value: ServerFnErrorErr) -> Self

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

Provided Methods§

Source

fn ser(&self) -> Bytes

Serializes the custom error type to bytes, according to the encoding given by Self::Encoding.

Source

fn de(data: Bytes) -> Self

Deserializes the custom error type, according to the encoding given by Self::Encoding.

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§

Source§

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