pub struct ExprArena { /* private fields */ }Expand description
Flat, index-addressed storage for all IrExpr nodes in a query plan.
Nodes are appended with push, which returns a stable
ExprId index. Because the arena is a plain Vec, serialisation
produces a JSON array where each element’s position is its ExprId.
§Example
use graphforge_ir::{ExprArena, IrExpr, IrLiteral, VarId, PropId};
use graphforge_ir::expr::BinaryOpKind;
let mut arena = ExprArena::new();
// Build: name = "Alice"
let var = arena.push(IrExpr::VarRef(VarId(0)));
let prop = arena.push(IrExpr::PropertyAccess { base: var, prop: PropId(1) });
let lit = arena.push(IrExpr::Literal(IrLiteral::Str("Alice".into())));
let eq = arena.push(IrExpr::BinaryOp { op: BinaryOpKind::Eq, left: prop, right: lit });
assert_eq!(arena.get(eq), &IrExpr::BinaryOp { op: BinaryOpKind::Eq, left: prop, right: lit });Implementations§
Source§impl ExprArena
impl ExprArena
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ExprArena
impl<'de> Deserialize<'de> for ExprArena
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for ExprArena
Auto Trait Implementations§
impl Freeze for ExprArena
impl RefUnwindSafe for ExprArena
impl Send for ExprArena
impl Sync for ExprArena
impl Unpin for ExprArena
impl UnsafeUnpin for ExprArena
impl UnwindSafe for ExprArena
Blanket Implementations§
impl<T> Allocation for T
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