ServerFnResult

Type Alias ServerFnResult 

Source
pub type ServerFnResult<T = ()> = Result<T, ServerFnError>;
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) -> Result<f32> {
    let parsed_number: f32 = number.parse()?;
    Ok(parsed_number)
}

Aliased Type§

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

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(ServerFnError)

Contains the error value