aztec-nr - std

Primitive type Module

A compile-time type which represents a module in this source program.

A Module is passed as the first argument to a macro attribute on top of a module:

#[attr]
mod foo {}

comptime fn attr(module: Module) {
    println(module.name()); // outputs "quote { foo }"
}

It can also be obtained using Quoted::as_module:

mod foo {}

fn main() {
    comptime {
        let module = quote { foo }.as_module().unwrap();
        println(module.name()); // outputs "quote { foo }"
    }
}

Implementations

impl Module

pub comptime fn add_item(self, item: Quoted) pub comptime fn has_named_attribute<let N: u32>(self, name: str<N>) -> bool pub comptime fn is_contract(self) -> bool pub comptime fn functions(self) -> [FunctionDefinition] pub comptime fn structs(self) -> [TypeDefinition] pub comptime fn child_modules(self) -> [Self] pub comptime fn name(self) -> Quoted pub comptime fn parent(self) -> Option<Self>

Trait implementations

impl Eq for Module

pub comptime fn eq(self, other: Self) -> bool

impl Hash for Module

pub comptime fn hash<H>(self, state: &mut H)
where H: Hasher