pub struct ExprArena { /* private fields */ }Expand description
An arena-based allocator for EventQL expressions.
The ExprArena provides a memory-efficient way to store and manage AST nodes
by using a flat vector and returning lightweight ExprRef handles.
Implementations§
Source§impl ExprArena
impl ExprArena
Sourcepub fn alloc_vec(&mut self, values: Vec<ExprRef>) -> VecRef
pub fn alloc_vec(&mut self, values: Vec<ExprRef>) -> VecRef
Allocates a vector of expression references and returns a VecRef handle.
Sourcepub fn alloc_rec(&mut self, values: Vec<Field>) -> RecRef
pub fn alloc_rec(&mut self, values: Vec<Field>) -> RecRef
Allocates a vector of record fields and returns a RecRef handle.
Sourcepub fn vec(&self, ptr: VecRef) -> &[ExprRef]
pub fn vec(&self, ptr: VecRef) -> &[ExprRef]
Returns the slice of expression references for the given VecRef.
Sourcepub fn vec_get(&self, ptr: VecRef, idx: usize) -> ExprRef
pub fn vec_get(&self, ptr: VecRef, idx: usize) -> ExprRef
Returns the expression reference at index idx within the given VecRef.
Sourcepub fn vec_idxes(&self, ptr: VecRef) -> impl Iterator<Item = usize> + use<>
pub fn vec_idxes(&self, ptr: VecRef) -> impl Iterator<Item = usize> + use<>
Returns an iterator over valid indices for the given VecRef.
Sourcepub fn rec(&self, ptr: RecRef) -> &Vec<Field>
pub fn rec(&self, ptr: RecRef) -> &Vec<Field>
Returns the vector of fields for the given RecRef.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExprArena
impl RefUnwindSafe for ExprArena
impl Send for ExprArena
impl Sync for ExprArena
impl Unpin for ExprArena
impl UnwindSafe for ExprArena
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