Skip to main content

BindModule

Trait BindModule 

Source
pub trait BindModule<T> {
    // Required method
    fn with_module(self, module_id: u8) -> FrozenResult<T>;
}
Expand description

Extension trait for FrozenResult to bind a module_id seamlessly

§Example

use frozen_core::error::{BindModule, FrozenError, FrozenResult, ErrCode};

fn backend_call() -> FrozenResult<()> {
    Err(FrozenError::unbound(0x08, ErrCode::new(0x10, "io"), "failed"))
}

let res = backend_call().with_module(0x02);
assert_eq!(res.unwrap_err().module, 0x02);

Required Methods§

Source

fn with_module(self, module_id: u8) -> FrozenResult<T>

Attaches module_id to the inner FrozenError if self is Err

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§