Skip to main content

n1_safe

Macro n1_safe 

Source
macro_rules! n1_safe {
    ($(#[$attr:meta])* $vis:vis fn $name:ident($($arg:ident: $argty:ty),*) $(-> $ret:ty)? $body:block) => { ... };
    ($(#[$attr:meta])* $vis:vis mod $name:ident $body:tt) => { ... };
}
Expand description

Marks a function or module as N1 (Type-Safe IPC) compliant.

N1 compliance means:

  • Zero unsafe blocks in the annotated code.
  • No raw pointer dereferences.
  • No asm! or FFI calls.
  • Only uses safe Rust abstractions.

The actual verification is done by cargo-geiger in CI. This macro is a documentation marker and a compile-time assertion that helps reviewers identify N1-safe boundaries.

§Example

ⓘ
use crate::ipc::n1::n1_safe;

#[n1_safe]
fn handle_nic_event(event: NicEvent) -> Result<(), IpcError> {
    NIC_SCHED_MAILBOX.send(&event.encode())?;
    Ok(())
}