pub struct ClosureExpr {
pub expr: DebugExpr,
pub singleton_refs: Vec<(Ident, HydroNode)>,
}Expand description
A closure expression bundled with any singleton references it captures.
When a q!() closure captures a SingletonRef, the reference is recorded here
alongside the closure’s expression. This allows per-closure tracking of singleton
captures, which is important for nodes with multiple closures (e.g. Fold has init and acc).
Fields§
§expr: DebugExpr§singleton_refs: Vec<(Ident, HydroNode)>Implementations§
Source§impl ClosureExpr
impl ClosureExpr
pub fn new(expr: DebugExpr, singleton_refs: Vec<(Ident, HydroNode)>) -> Self
pub fn deep_clone(&self, seen_tees: &mut SeenSharedNodes) -> Self
pub fn transform_children( &mut self, transform: &mut impl FnMut(&mut HydroNode, &mut SeenSharedNodes), seen_tees: &mut SeenSharedNodes, )
Sourcepub fn emit_tokens(&self, ident_stack: &mut Vec<Ident>) -> TokenStream
Available on crate feature build only.
pub fn emit_tokens(&self, ident_stack: &mut Vec<Ident>) -> TokenStream
build only.Pop singleton ref idents from the stack and rewrite the closure’s token stream,
replacing local singleton ref idents with #dfir_ident references.
Trait Implementations§
Source§impl Clone for ClosureExpr
impl Clone for ClosureExpr
Source§impl Debug for ClosureExpr
impl Debug for ClosureExpr
Source§impl Display for ClosureExpr
impl Display for ClosureExpr
Source§impl From<DebugExpr> for ClosureExpr
impl From<DebugExpr> for ClosureExpr
Source§impl From<Expr> for ClosureExpr
impl From<Expr> for ClosureExpr
Source§impl Hash for ClosureExpr
impl Hash for ClosureExpr
Auto Trait Implementations§
impl Freeze for ClosureExpr
impl !RefUnwindSafe for ClosureExpr
impl !Send for ClosureExpr
impl !Sync for ClosureExpr
impl Unpin for ClosureExpr
impl UnsafeUnpin for ClosureExpr
impl !UnwindSafe for ClosureExpr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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 moreCreates a shared type from an unshared type.