pub struct RefinementContext<'a> { /* private fields */ }Available on crate feature
codegen only.Expand description
Tracks refinement type constraints across scopes for mutation enforcement.
When a variable with a refinement type is defined, its constraint is registered
in the current scope. When that variable is mutated via Set, the assertion is
re-emitted to ensure the invariant is preserved.
§Scope Management
The context maintains a stack of scopes to handle nested blocks:
┌─────────────────────────────┐
│ Global Scope │ ← x: { it > 0 }
│ ┌──────────────────────┐ │
│ │ Zone Scope │ │ ← y: { it < 100 }
│ │ ┌────────────────┐ │ │
│ │ │ If Block Scope │ │ │ ← z: { it != 0 }
│ │ └────────────────┘ │ │
│ └──────────────────────┘ │
└─────────────────────────────┘§Variable Type Tracking
The context also tracks variable types for capability resolution. This allows
statements like Check that user can publish the document to resolve “the document”
to a variable named doc of type Document.
Implementations§
Source§impl<'a> RefinementContext<'a>
impl<'a> RefinementContext<'a>
Auto Trait Implementations§
impl<'a> Freeze for RefinementContext<'a>
impl<'a> RefUnwindSafe for RefinementContext<'a>
impl<'a> Send for RefinementContext<'a>
impl<'a> Sync for RefinementContext<'a>
impl<'a> Unpin for RefinementContext<'a>
impl<'a> UnwindSafe for RefinementContext<'a>
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