pub struct Expr { /* private fields */ }Expand description
A handle to an expression node.
A handle is valid only in the context, and the context generation, that created it. Using it
anywhere else is detected (best effort) and reported as Error::ForeignExpr or
Error::StaleExpr; it never silently refers to another node.
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn index(self) -> u32
pub fn index(self) -> u32
The node’s index. Indices are dense from 0 in creation order, and children always have lower indices than their parents. Useful as a key for caller-side dense tables.
Sourcepub fn to_bits(self) -> u64
pub fn to_bits(self) -> u64
The handle as one integer, never 0, for hosts that keep handles outside Rust (the C and
Python bindings). Expr::from_bits reads it back.
Sourcepub fn from_bits(bits: u64) -> Option<Expr>
pub fn from_bits(bits: u64) -> Option<Expr>
The handle Expr::to_bits gave, or None for 0. Any other integer reads as a handle:
a context rejects one it did not create (Error::ForeignExpr or
Error::StaleExpr), like any other foreign handle.