Type Alias ServerFnResult

Source
pub type ServerFnResult<T = (), E = String> = Result<T, ServerFnError<E>>;
Expand description

A default result type for server functions, which can either be successful or contain an error. The ServerFnResult type is a convenient alias for a Result type that uses ServerFnError as the error type.

§Example

use dioxus::prelude::*;

#[server]
async fn parse_number(number: String) -> ServerFnResult<f32> {
    let parsed_number: f32 = number.parse()?;
    Ok(parsed_number)
}

Aliased Type§

pub enum ServerFnResult<T = (), E = String> {
    Ok(T),
    Err(ServerFnError<E>),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(ServerFnError<E>)

Contains the error value