Struct artichoke_backend::state::State[][src]

pub struct State {
    pub parser: Option<State>,
    pub classes: Registry,
    pub modules: Registry,
    pub vfs: Adapter,
    pub regexp: State,
    pub symbols: SymbolTable,
    pub output: Strategy,
    pub prng: Random,

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


parser: Option<State>classes: Registrymodules: Registryvfs: Adapterregexp: Statesymbols: SymbolTableoutput: Strategyprng: Random


impl State[src]

pub fn new() -> Result<Self, InterpreterAllocError>[src]

Create a new State.

The state is comprised of several components:


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

Trait Implementations

impl Debug for State[src]

impl Default for State[src]

Auto Trait Implementations

impl RefUnwindSafe for State

impl !Send for State

impl !Sync for State

impl Unpin for State

impl UnwindSafe for State

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,