pub type ViewResult<T> = Result<T>;Expand description
A convenient type alias for view/endpoint function return types.
This type alias is commonly used in endpoint handlers to simplify function signatures.
It wraps any type T (typically Response) with a dynamic error type that can
represent various kinds of errors that might occur during request processing.
The Send + Sync bounds ensure this type is safe to use across thread boundaries,
which is essential for async runtime environments.
§Examples
use reinhardt_http::{Response, ViewResult};
async fn hello_world() -> ViewResult<Response> {
Ok(Response::ok().with_body("Hello, World!"))
}
#[tokio::main]
let response = hello_world().await.unwrap();
assert_eq!(response.status, hyper::StatusCode::OK);Result type for view handlers using reinhardt’s unified Error type.
This type alias ensures compatibility with UnifiedRouter::function which requires
Future<Output = Result<Response>> where Result is reinhardt_core::exception::Result.
Aliased Type§
pub enum ViewResult<T> {
Ok(T),
Err(Error),
}