pub struct State { /* private fields */ }
Implementations§
Source§impl State
impl State
pub fn new(mrb: &mut mrb_state) -> Option<Self>
pub fn close(self, mrb: &mut mrb_state)
pub fn context_mut(&mut self) -> &mut mrbc_context
Sourcepub fn fetch_lineno(&self) -> usize
pub fn fetch_lineno(&self) -> usize
Fetch the current line number from the parser state.
Sourcepub fn add_fetch_lineno(
&mut self,
val: usize,
) -> Result<usize, IncrementLinenoError>
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.
Sourcepub fn push_context(&mut self, mrb: &mut mrb_state, context: Context)
pub fn push_context(&mut self, mrb: &mut mrb_state, context: Context)
Sourcepub fn pop_context(&mut self, mrb: &mut mrb_state) -> Option<Context>
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 eval
ed
code will use the current active Context
.
Sourcepub fn peek_context(&self) -> Option<&Context>
pub fn peek_context(&self) -> Option<&Context>
Returns the last Context
, or None
if the context stack is empty.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more