artichoke_backend::state::parser

Struct State

Source
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>,

Source§

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

Source§

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.