pub struct ClosureRegistry { /* private fields */ }Expand description
Registry of closure capture layouts, keyed on capture signature AND per-capture kind.
Track A.1C.2: the registry key is (capture_types, capture_kinds).
Two closures with identical capture types but different kinds (e.g.
one captures a let and another captures a var of the same type)
MUST NOT share a layout — the masks, release glue, and code emission
differ. The legacy intern(capture_types) entry point defaults all
kinds to Immutable and is the common case; the new
intern_with_kinds variant keys on the kind vector as well.
Implementations§
Source§impl ClosureRegistry
impl ClosureRegistry
Sourcepub fn intern(&mut self, capture_types: Vec<ConcreteType>) -> ClosureTypeId
pub fn intern(&mut self, capture_types: Vec<ConcreteType>) -> ClosureTypeId
Intern a capture signature with every capture defaulted to
CaptureKind::Immutable. Returns an existing id if the
(types, all-Immutable kinds) key is present.
Sourcepub fn intern_with_kinds(
&mut self,
capture_types: Vec<ConcreteType>,
capture_kinds: Vec<CaptureKind>,
) -> ClosureTypeId
pub fn intern_with_kinds( &mut self, capture_types: Vec<ConcreteType>, capture_kinds: Vec<CaptureKind>, ) -> ClosureTypeId
Intern a capture signature with explicit per-capture kinds.
Two closures with identical types but different kinds get
distinct ClosureTypeIds.
Sourcepub fn get(&self, id: ClosureTypeId) -> Option<&ClosureLayout>
pub fn get(&self, id: ClosureTypeId) -> Option<&ClosureLayout>
Get the layout for a previously interned ClosureTypeId.
Sourcepub fn iter(&self) -> impl Iterator<Item = (ClosureTypeId, &ClosureLayout)>
pub fn iter(&self) -> impl Iterator<Item = (ClosureTypeId, &ClosureLayout)>
Iterate over all (ClosureTypeId, ClosureLayout) pairs.
Sourcepub fn lookup(&self, capture_types: &[ConcreteType]) -> Option<ClosureTypeId>
pub fn lookup(&self, capture_types: &[ConcreteType]) -> Option<ClosureTypeId>
Look up a ClosureTypeId by capture signature (all-Immutable
kinds) without interning. Returns None if not seen before.
Trait Implementations§
Source§impl Clone for ClosureRegistry
impl Clone for ClosureRegistry
Source§fn clone(&self) -> ClosureRegistry
fn clone(&self) -> ClosureRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more