Macro create_capability

Source
macro_rules! create_capability {
    ($($T:ty),+) => { ... };
}
Expand description

Create an object with the given capabilities.

let process_mgmt_cap = create_capability!(ProcessManagementCapability);
let unified_cap = create_capability!(ProcessManagementCapability, MemoryAllocationCapability);

This helper macro cannot be called from #![forbid(unsafe_code)] crates, and is used by trusted code to generate a capability that it can either use or pass to another module.

§Safety

This macro can only be used in a context that is allowed to use unsafe. Specifically, an internal allow(unsafe_code) directive will conflict with any forbid(unsafe_code) at the crate or block level.

#[forbid(unsafe_code)]
fn untrusted_fn() {
    let process_mgmt_cap = create_capability!(ProcessManagementCapability);
}