Skip to main content

main

Attribute Macro main 

Source
#[main]
Expand description

Injects CapRoot creation into a function entry point.

Removes the first parameter (which must be typed as CapRoot) and prepends let {param_name} = capsec::root(); to the function body.

§Usage

#[capsec::main]
fn main(root: CapRoot) {
    let fs = root.fs_read();
    // ...
}

§With #[tokio::main]

Place #[capsec::main] above #[tokio::main]:

#[capsec::main]
#[tokio::main]
async fn main(root: CapRoot) { ... }