pub struct Budget { /* private fields */ }Expand description
The fuel of one request: runtime steps plus input reads, shared by every evaluation the
request makes. When it runs out, the request fails with BudgetExceeded and stores
nothing.
Implementations§
Source§impl Budget
impl Budget
Sourcepub fn new(fuel: u64) -> Budget
pub fn new(fuel: u64) -> Budget
A budget of fuel units (for a runtime’s own tests; the engine makes the budget of a
request from its configured fuel).
Sourcepub fn charge(&mut self, steps: u64) -> Result<(), EvalError>
pub fn charge(&mut self, steps: u64) -> Result<(), EvalError>
Charges steps units of work. EvalError::BudgetExceeded when fewer remain: the
budget is then exhausted for the rest of the request.
Sourcepub fn is_exhausted(&self) -> bool
pub fn is_exhausted(&self) -> bool
Whether a charge has failed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Budget
impl RefUnwindSafe for Budget
impl Send for Budget
impl Sync for Budget
impl Unpin for Budget
impl UnsafeUnpin for Budget
impl UnwindSafe for Budget
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