lxy 0.1.1

A convenient async http and RPC framework in Rust
Documentation
use super::Error;

/// A convenient `Result` type alias for lxy errors.
///
/// This type alias simplifies function signatures by defaulting to [`Error`]
/// as the error type. It's the recommended return type for all fallible
/// operations in lxy applications.
///
/// # Examples
///
/// ```
/// use lxy::{define_error, error::{Result, ErrorCode, TypedError}};
///
/// define_error!(ErrorCode::InvalidInput, InvalidInput);
///
/// fn validate_age(age: i32) -> Result<()> {
///     if age < 0 {
///         return Err(InvalidInput::error("Age cannot be negative"));
///     }
///     Ok(())
/// }
/// ```
///
/// ## With the `?` Operator
///
/// ```
/// use lxy::{define_error, error::{Result, ErrorCode, TypedError}};
///
/// define_error!(ErrorCode::ResourceNotFound, UserNotFound);
///
/// struct User;
///
/// fn find_user(id: u32) -> Option<User> { None }
///
/// fn get_user(id: u32) -> Result<User> {
///     find_user(id)
///         .ok_or_else(|| UserNotFound::error(format!("User {} not found", id)))
/// }
///
/// fn get_user_name(id: u32) -> Result<String> {
///     let _user = get_user(id)?;
///     Ok("Alice".to_string())
/// }
/// ```
pub type Result<T, E = Error> = std::result::Result<T, E>;