pub struct RemainingSteps { /* private fields */ }Expand description
Remaining steps tracker for recursion limit
Tracks and manages the remaining execution steps to prevent infinite loops. This is actively decremented during execution and can be checked by nodes.
§Example
ⓘ
let remaining = RemainingSteps::new(100);
// Check before proceeding
if remaining.is_exhausted() {
return Err(AgentError::RecursionLimitExceeded);
}
// Decrement after each step
remaining.decrement();Implementations§
Source§impl RemainingSteps
impl RemainingSteps
Sourcepub async fn decrement_by(&self, amount: u32) -> u32
pub async fn decrement_by(&self, amount: u32) -> u32
Decrement by a specific amount
Sourcepub async fn is_exhausted(&self) -> bool
pub async fn is_exhausted(&self) -> bool
Check if steps are exhausted
Sourcepub async fn has_at_least(&self, n: u32) -> bool
pub async fn has_at_least(&self, n: u32) -> bool
Check if we have at least N steps remaining
Trait Implementations§
Source§impl Clone for RemainingSteps
impl Clone for RemainingSteps
Source§fn clone(&self) -> RemainingSteps
fn clone(&self) -> RemainingSteps
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RemainingSteps
impl !RefUnwindSafe for RemainingSteps
impl Send for RemainingSteps
impl Sync for RemainingSteps
impl Unpin for RemainingSteps
impl UnsafeUnpin for RemainingSteps
impl !UnwindSafe for RemainingSteps
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