pub struct Context<'runtime, 'program, 'reader, 'parselet> { /* private fields */ }
Expand description
Contexts represent stack frames for parselet calls.
Via the context, most operations regarding capture storing and loading is performed.
Implementations
sourceimpl<'runtime, 'program, 'reader, 'parselet> Context<'runtime, 'program, 'reader, 'parselet>
impl<'runtime, 'program, 'reader, 'parselet> Context<'runtime, 'program, 'reader, 'parselet>
pub fn new(
runtime: &'runtime mut Runtime<'program, 'reader>,
parselet: &'parselet Parselet,
locals: usize,
take: usize,
hold: usize,
depth: usize
) -> Self
sourcepub fn push(&self, value: RefValue) -> Result<Accept, Reject>
pub fn push(&self, value: RefValue) -> Result<Accept, Reject>
Shortcut for an Ok(Accept::Push) with the given value. To push a value immediatelly, use context.runtime.stack.push().
pub fn load(&mut self, index: usize) -> Result<Accept, Reject>
sourcepub fn get_capture(&mut self, pos: usize) -> Option<RefValue>
pub fn get_capture(&mut self, pos: usize) -> Option<RefValue>
Return a capture by index as RefValue.
sourcepub fn get_capture_by_name(&mut self, name: &str) -> Option<RefValue>
pub fn get_capture_by_name(&mut self, name: &str) -> Option<RefValue>
Return a capture by name as RefValue.
sourcepub fn set_capture(&mut self, pos: usize, value: RefValue)
pub fn set_capture(&mut self, pos: usize, value: RefValue)
Set a capture to a RefValue by index.
sourcepub fn set_capture_by_name(&mut self, name: &str, value: RefValue)
pub fn set_capture_by_name(&mut self, name: &str, value: RefValue)
Set a capture to a RefValue by name.
Trait Implementations
Auto Trait Implementations
impl<'runtime, 'program, 'reader, 'parselet> !RefUnwindSafe for Context<'runtime, 'program, 'reader, 'parselet>
impl<'runtime, 'program, 'reader, 'parselet> !Send for Context<'runtime, 'program, 'reader, 'parselet>
impl<'runtime, 'program, 'reader, 'parselet> !Sync for Context<'runtime, 'program, 'reader, 'parselet>
impl<'runtime, 'program, 'reader, 'parselet> Unpin for Context<'runtime, 'program, 'reader, 'parselet> where
'program: 'runtime,
'reader: 'runtime,
impl<'runtime, 'program, 'reader, 'parselet> !UnwindSafe for Context<'runtime, 'program, 'reader, 'parselet>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more