rail_unboxed

Macro rail_unboxed 

Source
macro_rules! rail_unboxed {
    ($expr:expr $(,)?) => { ... };
}
Expand description

Wraps a Result-producing expression or block and converts it into an unboxed ComposableResult.

This macro is similar to rail! but returns an unboxed error. Use this when you need to avoid heap allocation or when working with APIs that expect the unboxed ComposableError<E> type.

§Syntax

  • rail_unboxed!(expr) - Wraps a single Result-producing expression
  • rail_unboxed!({ ... }) - Wraps a block that produces a Result

§Returns

A ComposableResult<T, E> where the error type is wrapped in a ComposableError but not boxed.

§Examples

use error_rail::{rail_unboxed, group};

// Simple expression - returns unboxed error
let result = rail_unboxed!(Err::<(), &str>("failed"));
assert!(result.is_err());
// Error type is ComposableError<&str> (not boxed)
let _: error_rail::ComposableError<&str> = result.unwrap_err();

// Block syntax with multiple statements
let result = rail_unboxed!({
    let value = std::fs::read_to_string("config.txt");
    value
});