pub struct Module {
    pub name: String,
    /* private fields */
}
Expand description

Defines a module.

Fields

name: String

Module name

Implementations

Return a new, blank module

Returns a mutable reference to the module’s scope.

Set the module visibility.

Import a type into the module’s scope.

This results in a new use statement bein added to the beginning of the module.

Add an attribute to the module.

Push a new module definition, returning a mutable reference to it.

Panics

Since a module’s name must uniquely identify it within the scope in which it is defined, pushing a module whose name is already defined in this scope will cause this function to panic.

In many cases, the get_or_new_module function is preferrable, as it will return the existing definition instead.

Returns a reference to a module if it is exists in this scope.

Returns a mutable reference to a module if it is exists in this scope.

Returns a mutable reference to a module, creating it if it does not exist.

Push a module definition.

Panics

Since a module’s name must uniquely identify it within the scope in which it is defined, pushing a module whose name is already defined in this scope will cause this function to panic.

In many cases, the get_or_new_module function is preferrable, as it will return the existing definition instead.

Push a new struct definition, returning a mutable reference to it.

Push a structure definition

Push a new function definition, returning a mutable reference to it.

Push a function definition

Push a new enum definition, returning a mutable reference to it.

Push an enum definition

Push a new impl block, returning a mutable reference to it.

Push an impl block.

Push a new trait

Push a trait definition

Formats the module using the given formatter.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.