Skip to main content

ExprNode

Trait ExprNode 

Source
pub trait ExprNode: Copy {
    type Args: Iterator<Item = Self> + ExactSizeIterator + Clone;

    // Required methods
    fn size(self) -> Option<usize>;
    fn kind<'a>(self) -> ExprKind<'a, Self>
       where Self: 'a;
}
Expand description

One p-code expression, generic over how it is stored.

A node is a cheap handle — the passes copy it freely and ask for its kind and size more than once — so an implementation should be a reference plus whatever context resolves it, never an owned tree.

Required Associated Types§

Source

type Args: Iterator<Item = Self> + ExactSizeIterator + Clone

The arguments of a call node, in order.

Required Methods§

Source

fn size(self) -> Option<usize>

The width in bytes this node carries, if the producer knows one.

This is the Expression::size a materialised AST would have: what was written, or what the producer inferred while expanding. None leaves the passes to derive one from the node’s shape.

Source

fn kind<'a>(self) -> ExprKind<'a, Self>
where Self: 'a,

The shape of this node, with its children as nodes of the same kind.

'a is the life of anything the shape borrows from the node — the name of a deferred load space — so it is bounded by the node’s own.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, S> ExprNode for &'a Expression<S>