pub struct ClosureRegistry { /* private fields */ }Expand description
Registry for tracking closures across a codebase
Implementations§
Source§impl ClosureRegistry
impl ClosureRegistry
Sourcepub fn register_closure(&mut self, info: ClosureInfo)
pub fn register_closure(&mut self, info: ClosureInfo)
Register a closure
Sourcepub fn get_closure(&self, name: &str) -> Option<&ClosureInfo>
pub fn get_closure(&self, name: &str) -> Option<&ClosureInfo>
Get closure info by name
Sourcepub fn get_closures_for_parent(&self, parent: &str) -> Vec<&ClosureInfo>
pub fn get_closures_for_parent(&self, parent: &str) -> Vec<&ClosureInfo>
Get all closures for a parent function
Sourcepub fn bind_closure(
&mut self,
parent: String,
var: String,
closure_name: String,
)
pub fn bind_closure( &mut self, parent: String, var: String, closure_name: String, )
Bind a closure variable to a closure
Sourcepub fn get_closure_binding(&self, parent: &str, var: &str) -> Option<&String>
pub fn get_closure_binding(&self, parent: &str, var: &str) -> Option<&String>
Look up which closure a variable refers to
Sourcepub fn get_all_parents(&self) -> Vec<String>
pub fn get_all_parents(&self) -> Vec<String>
Get all parent function names that have closures
Sourcepub fn get_all_closures(&self) -> Vec<&ClosureInfo>
pub fn get_all_closures(&self) -> Vec<&ClosureInfo>
Get all closures in the registry
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClosureRegistry
impl RefUnwindSafe for ClosureRegistry
impl Send for ClosureRegistry
impl Sync for ClosureRegistry
impl Unpin for ClosureRegistry
impl UnsafeUnpin for ClosureRegistry
impl UnwindSafe for ClosureRegistry
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> 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 more