1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use crateError;
use crateResponse;
use Bytes;
use Full;
use Incoming;
/// A result type using anyhow for error handling.
///
/// This is used for operations that may fail but don't need framework-specific
/// error types, such as JSON parsing or file operations.
///
/// # Type Parameters
///
/// * `T` - The success type
///
/// # Example
///
/// ```rust,ignore
/// use desirable::AnyResult;
///
/// async fn parse_json() -> AnyResult<serde_json::Value> {
/// let data = std::fs::read_to_string("data.json")?;
/// Ok(serde_json::from_str(&data)?)
/// }
/// ```
pub type AnyResult<T> = Result;
/// The default result type for the framework.
///
/// When used without a type parameter, the success type defaults to [`Response`].
/// This is the standard return type for handlers and most framework operations.
///
/// # Type Parameters
///
/// * `T` - The success type (defaults to `Response`)
///
/// # Example
///
/// ```rust,ignore
/// use desirable::{Request, Result};
///
/// async fn handler(req: Request) -> Result {
/// Ok("Hello!".into())
/// }
/// ```
pub type Result<T = Response> = Result;
/// Type alias for the underlying hyper response type.
///
/// Represents a complete HTTP response with a `Full<Bytes>` body.
pub type HyperResponse = Response;
/// Type alias for the underlying hyper request type.
///
/// Represents an incoming HTTP request with an `Incoming` body.
pub type HyperRequest = Request;