pub struct FlowQuota { /* private fields */ }Implementations§
Source§impl FlowQuota
impl FlowQuota
pub fn from_config(cfg: QuotaConfig) -> Self
pub fn new( cpu_budget: i64, mem_limit: usize, spawn_burst: i64, spawn_per_sec: i64, send_burst: i64, send_per_sec: i64, ) -> Self
pub fn remaining_cpu(&self) -> i64
Sourcepub fn charge_cpu(&self, cost: i64) -> Result<(), QuotaError>
pub fn charge_cpu(&self, cost: i64) -> Result<(), QuotaError>
Call once per executed instruction (or every N, in a batch — the batch only thickens trap latency, it does not change the limit).
pub fn alloc(&self, bytes: usize) -> Result<(), QuotaError>
pub fn free(&self, bytes: usize)
pub fn check_spawn(&self) -> Result<(), QuotaError>
pub fn check_send(&self) -> Result<(), QuotaError>
Sourcepub fn top_up_cpu(&self, extra: i64)
pub fn top_up_cpu(&self, extra: i64)
Reachable only after check_admin against CapTarget::Scheduler.
pub fn mem_used(&self) -> usize
Auto Trait Implementations§
impl !Freeze for FlowQuota
impl RefUnwindSafe for FlowQuota
impl Send for FlowQuota
impl Sync for FlowQuota
impl Unpin for FlowQuota
impl UnsafeUnpin for FlowQuota
impl UnwindSafe for FlowQuota
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