Type Alias Hatch

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

Ergonomic type alias for Result<T, Yoshi> with thematic naming.

This type alias provides expressive naming that aligns with the Yoshi metaphorical framework while maintaining zero-cost abstraction guarantees. It automatically adapts between std::result::Result and core::result::Result based on features.

§Performance Characteristics

  • Time Complexity: O(1) for all operations (zero-cost abstraction)
  • Space Complexity: Identical to Result<T, Yoshi> (no overhead)
  • Memory Layout: Exact same representation as standard Result

§Examples

use yoshi_std::{Hatch, Yoshi, YoshiKind};

fn load_config() -> Hatch<String> {
    Ok("configuration data".into())
}

fn process_data() -> Hatch<u32> {
    Err(Yoshi::new(YoshiKind::Internal {
        message: "processing failed".into(),
        source: None,
        component: None,
    }))
}

Aliased Type§

pub enum Hatch<T> {
    Ok(T),
    Err(Yoshi),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(Yoshi)

Contains the error value

Trait Implementations§

Source§

impl<T> LayContext<T> for Hatch<T>

Source§

fn lay(self, message: impl Into<String>) -> Hatch<T>

Adds a contextual message to the error chain, like laying an egg with metadata. Read more