pub struct State { /* private fields */ }

Implementations§

source§

impl State

source

pub fn new(mrb: &mut mrb_state) -> Option<Self>

source

pub fn close(self, mrb: &mut mrb_state)

source

pub fn context_mut(&mut self) -> &mut mrbc_context

source

pub fn reset(&mut self, mrb: &mut mrb_state)

Reset line number to 1.

source

pub fn fetch_lineno(&self) -> usize

Fetch the current line number from the parser state.

source

pub fn add_fetch_lineno( &mut self, val: usize ) -> Result<usize, IncrementLinenoError>

Increment line number and return the new value.

§Errors

This function returns IncrementLinenoError if the increment results in an overflow of the internal parser line number counter.

source

pub fn push_context(&mut self, mrb: &mut mrb_state, context: Context)

Push a Context onto the stack.

The supplied Context becomes the currently active context. This function modifies the parser state so subsequently evaled code will use the current active Context.

source

pub fn pop_context(&mut self, mrb: &mut mrb_state) -> Option<Context>

Removes the last element from the context stack and returns it, or None if the stack is empty.

Calls to this function modify the parser state so subsequently evaled code will use the current active Context.

source

pub fn peek_context(&self) -> Option<&Context>

Returns the last Context, or None if the context stack is empty.

Trait Implementations§

source§

impl Debug for State

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for State

§

impl RefUnwindSafe for State

§

impl !Send for State

§

impl !Sync for State

§

impl Unpin for State

§

impl UnwindSafe for State

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.