pub struct RootRef {
pub node: Arc<Node>,
pub scope: Option<Arc<Scope>>,
pub parent_fallback: Option<Arc<Scope>>,
}Expand description
Anchor for &root lookups in a Scope.
The three fields move as a unit because they all describe one root —
previously they lived as three loose Option<Arc<…>> fields on Scope
(reference_root / reference_root_scope / reference_root_parent)
whose relationship was only documented in prose. Bundling them here
makes the invariant structural: node is always present once a root
is set, and the synthesized-vs-pinned distinction is encoded in
scope being Some or None.
Fields§
§node: Arc<Node>AST node that &root resolves against.
scope: Option<Arc<Scope>>Pre-built scope already pinned at node — set by the dict branch
of the evaluator’s main walk once the dict being evaluated is
node. When None, reference resolution synthesizes a transient
root scope on demand whose parent is parent_fallback.
parent_fallback: Option<Arc<Scope>>Parent fallback used when synthesizing the transient root scope.
Today this is the closure-body bindings scope so &root inside a
closure body still sees the caller’s bindings.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RootRef
impl RefUnwindSafe for RootRef
impl Send for RootRef
impl Sync for RootRef
impl Unpin for RootRef
impl UnsafeUnpin for RootRef
impl UnwindSafe for RootRef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more