pub struct ExprArena {
pub exprs: Arena<ExprNode>,
pub patterns: Arena<ArmPatternNode>,
}Expand description
Owns all ExprNodes and ArmPatternNodes for a single compiled Rib
expression. Children are referenced by index, never by pointer.
Fields§
§exprs: Arena<ExprNode>§patterns: Arena<ArmPatternNode>Implementations§
Source§impl ExprArena
impl ExprArena
pub fn new() -> Self
Sourcepub fn alloc_expr(&mut self, node: ExprNode) -> ExprId
pub fn alloc_expr(&mut self, node: ExprNode) -> ExprId
Allocate a new expression node, returning its stable ExprId.
Sourcepub fn alloc_pattern(&mut self, node: ArmPatternNode) -> ArmPatternId
pub fn alloc_pattern(&mut self, node: ArmPatternNode) -> ArmPatternId
Allocate a new arm-pattern node, returning its stable ArmPatternId.
Sourcepub fn expr_mut(&mut self, id: ExprId) -> &mut ExprNode
pub fn expr_mut(&mut self, id: ExprId) -> &mut ExprNode
Look up an expression node mutably by id.
Used by passes that perform structural mutations (e.g. converting an
Identifier node into a Call node during enum/variant inference).
Sourcepub fn pattern(&self, id: ArmPatternId) -> &ArmPatternNode
pub fn pattern(&self, id: ArmPatternId) -> &ArmPatternNode
Look up a pattern node by id.
Sourcepub fn pattern_mut(&mut self, id: ArmPatternId) -> &mut ArmPatternNode
pub fn pattern_mut(&mut self, id: ArmPatternId) -> &mut ArmPatternNode
Look up a pattern node mutably by id.
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 UnsafeUnpin 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