Result

Type Alias Result 

Source
pub type Result<T> = Result<T, Error>;
Expand description

A specialized Result type for HTTP operations.

This is a convenience alias for Result<T, Error> that’s used throughout the HTTP toolkit to simplify error handling in HTTP contexts.

§Examples

use http_kit::{Result, Error};
use http::StatusCode;

fn example_function() -> Result<String> {
    Ok("success".to_string())
}

fn failing_function() -> Result<()> {
    Err(Error::msg("failed").set_status(StatusCode::INTERNAL_SERVER_ERROR))
}

Aliased Type§

pub enum Result<T> {
    Ok(T),
    Err(Error),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(Error)

Contains the error value