pub struct State {
    pub parser: Option<State>,
    pub classes: Registry,
    pub modules: Registry,
    pub load_path_vfs: Adapter,
    pub regexp: State,
    pub symbols: SymbolTable,
    pub output: Strategy,
    pub hash_builder: RandomState,
    pub prng: Random,
}
Expand description

Container for interpreter global state.

A Ruby interpreter requires various pieces of state to execute Ruby code. It needs an object heap, type registry, symbol table, pseudorandom number generator, and more.

This struct stores all of these components and allows them to be passed around as one bundle. This is useful in FFI contexts because this State can be Boxed and stored in a user data pointer.

Fields

parser: Option<State>classes: Registrymodules: Registryload_path_vfs: Adapterregexp: Statesymbols: SymbolTableoutput: Strategyhash_builder: RandomStateprng: Random

Implementations

Create a new State.

The state is comprised of several components:

Errors

If the core-random feature is enabled, this function may return an error if the interpreter-global pseudorandom number generator fails to initialize using the platform source of randomness.

Trait Implementations

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 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.