pub struct LocatedExprTree {
pub expr: Expr,
pub origin: Option<Origin>,
pub children: Vec<LocatedExprTree>,
}Expand description
A located expression together with its located children.
Carries per-node Origin for a whole expression tree, so codecs can
preserve source spans down to each sub-form.
Fields§
§expr: ExprThe expression at this node.
origin: Option<Origin>The optional source origin of this node.
children: Vec<LocatedExprTree>The located child nodes.
Implementations§
Source§impl LocatedExprTree
impl LocatedExprTree
Sourcepub fn canonical_eq(&self, other: &Self) -> bool
pub fn canonical_eq(&self, other: &Self) -> bool
Compares two trees canonically, ignoring origin, including children.
Sourcepub fn located(&self) -> LocatedExpr
pub fn located(&self) -> LocatedExpr
Projects this node to a flat LocatedExpr, dropping children.
Sourcepub fn without_children(expr: Expr, origin: Option<Origin>) -> Self
pub fn without_children(expr: Expr, origin: Option<Origin>) -> Self
Builds a leaf tree node with no children.
Sourcepub fn from_located(located: LocatedExpr) -> Self
pub fn from_located(located: LocatedExpr) -> Self
Lifts a flat LocatedExpr into a leaf tree node.
Sourcepub fn from_expr_recursive(expr: Expr) -> Self
pub fn from_expr_recursive(expr: Expr) -> Self
Builds a tree from expr by recursively wrapping its children, with no origins.
Trait Implementations§
Source§impl Clone for LocatedExprTree
impl Clone for LocatedExprTree
Source§fn clone(&self) -> LocatedExprTree
fn clone(&self) -> LocatedExprTree
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LocatedExprTree
impl Debug for LocatedExprTree
impl Eq for LocatedExprTree
Source§impl Hash for LocatedExprTree
impl Hash for LocatedExprTree
Source§impl PartialEq for LocatedExprTree
impl PartialEq for LocatedExprTree
Source§fn eq(&self, other: &LocatedExprTree) -> bool
fn eq(&self, other: &LocatedExprTree) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for LocatedExprTree
Auto Trait Implementations§
impl Freeze for LocatedExprTree
impl RefUnwindSafe for LocatedExprTree
impl Send for LocatedExprTree
impl Sync for LocatedExprTree
impl Unpin for LocatedExprTree
impl UnsafeUnpin for LocatedExprTree
impl UnwindSafe for LocatedExprTree
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