pub struct Scope { /* private fields */ }
Expand description

Defines a scope.

A scope contains modules, types, etc…

Implementations

Returns a new scope

Import a type into the scope.

This results in a new use statement being added to the beginning of the scope.

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 mutable 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 struct definition

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

Push a function definition

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

Push a trait definition

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

Push a structure definition

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

Push an impl block.

Push a raw string to the scope.

This string will be included verbatim in the formatted string.

Push a new TypeAlias, returning a mutable reference to it.

Push an TypeAlias.

Return a string representation of the scope.

Formats the scope 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.