Skip to main content

IntoHandlerResult

Trait IntoHandlerResult 

Source
pub trait IntoHandlerResult: Send {
    // Required method
    fn into_handler_result(self) -> Result<String, String>;
}
Expand description

Trait for converting handler return values into Result<String, String>.

This is the handler equivalent of axum’s IntoResponse. By implementing this trait for different return types, a single set of handler structs can support String passthrough, Json<T> auto-serialization, and Result<T, E> error handling.

Required Methods§

Source

fn into_handler_result(self) -> Result<String, String>

Convert this value into the handler’s wire result.

Implementations on Foreign Types§

Source§

impl IntoHandlerResult for String

String passes through verbatim (backwards-compatible with existing handlers).

Source§

impl<T: Serialize + Send, E: Display + Send> IntoHandlerResult for Result<T, E>

Result<T, E> serializes Ok(T) to JSON and stringifies Err(E).

Implementors§