dioxus_static_site_generation::prelude::server_fn::error

Trait ServerFnErrorSerde

Source
pub trait ServerFnErrorSerde: Sized {
    // Required methods
    fn ser(&self) -> Result<String, Error>;
    fn de(data: &str) -> Self;
}
Expand description

A serializable custom server function error type.

This is implemented for all types that implement FromStr + Display.

This means you do not necessarily need the overhead of serde for a custom error type. Instead, you can use something like strum to derive FromStr and Display for your custom error type.

This is implemented for the default ServerFnError, which uses NoCustomError.

Required Methods§

Source

fn ser(&self) -> Result<String, Error>

Converts the custom error type to a String.

Source

fn de(data: &str) -> Self

Deserializes the custom error type from a String.

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> ServerFnErrorSerde for ServerFnError<CustErr>
where CustErr: FromStr + Display,