pub struct ResourceState {
pub current_depth: u32,
pub expansion_size: u32,
pub max_depth: u32,
pub max_exp_size: u32,
}Expand description
Tracks resource consumption during bounded evaluation (REQ-071).
Fields§
§current_depth: u32§expansion_size: u32§max_depth: u32§max_exp_size: u32Implementations§
Source§impl ResourceState
impl ResourceState
Sourcepub fn new(max_depth: u32, max_exp_size: u32) -> Self
pub fn new(max_depth: u32, max_exp_size: u32) -> Self
Create a new resource state from resource bounds.
Sourcepub fn enter_depth(&self) -> Option<ResourceState>
pub fn enter_depth(&self) -> Option<ResourceState>
Enter a deeper nesting level, returning None if bounds exceeded (REQ-071).
Uses strict < matching ResourceState.enterDepth in
R2ResourceBounds.lean:36–40.
Sourcepub fn add_expansion(&self, size: u32) -> Option<ResourceState>
pub fn add_expansion(&self, size: u32) -> Option<ResourceState>
Add expansion size, returning None if bounds exceeded (REQ-071).
Uses strict < matching ResourceState.addExpansion in
R2ResourceBounds.lean:43–47.
Sourcepub fn exit_depth(&self) -> ResourceState
pub fn exit_depth(&self) -> ResourceState
Exit a nesting level.
Sourcepub fn remaining_depth(&self) -> u32
pub fn remaining_depth(&self) -> u32
Remaining depth steps before limit.
Matches ResourceState.remainingDepth in R2ResourceBounds.lean:33–34.
Sourcepub fn initial(bounds: &ResourceBounds) -> Self
pub fn initial(bounds: &ResourceBounds) -> Self
Create initial resource state from resource bounds.
Matches ResourceState.initial in R2ResourceBounds.lean:54–56.
Trait Implementations§
Source§impl Clone for ResourceState
impl Clone for ResourceState
Source§impl Debug for ResourceState
impl Debug for ResourceState
impl Eq for ResourceState
Source§impl PartialEq for ResourceState
impl PartialEq for ResourceState
impl StructuralPartialEq for ResourceState
Auto Trait Implementations§
impl Forget for ResourceState
impl Freeze for ResourceState
impl Move for ResourceState
impl RefUnwindSafe for ResourceState
impl Send for ResourceState
impl Sync for ResourceState
impl Unpin for ResourceState
impl UnsafeUnpin for ResourceState
impl UnwindSafe for ResourceState
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