pub struct ResourceBudget { /* private fields */ }Expand description
Shared, allocation-before-ownership resource budget.
Implementations§
Source§impl ResourceBudget
impl ResourceBudget
Sourcepub fn from_options(options: StreamOptions) -> Self
pub fn from_options(options: StreamOptions) -> Self
Create a budget from public bounded-execution options.
Sourcepub fn new(memory_limit_bytes: u64, max_in_flight_batches: NonZeroUsize) -> Self
pub fn new(memory_limit_bytes: u64, max_in_flight_batches: NonZeroUsize) -> Self
Create a budget with a byte limit and a positive in-flight batch limit.
Sourcepub fn reserve(
&self,
scope: ResourceScope,
bytes: u64,
) -> Result<ResourceReservation>
pub fn reserve( &self, scope: ResourceScope, bytes: u64, ) -> Result<ResourceReservation>
Reserve byte ownership before allocating or retaining data.
Sourcepub fn reserve_batch(
&self,
scope: ResourceScope,
bytes: u64,
) -> Result<ResourceReservation>
pub fn reserve_batch( &self, scope: ResourceScope, bytes: u64, ) -> Result<ResourceReservation>
Reserve ownership for one decoded or retained batch before publishing it.
Sourcepub const fn memory_limit_bytes(&self) -> u64
pub const fn memory_limit_bytes(&self) -> u64
Return the configured byte limit.
Sourcepub const fn max_in_flight_batches(&self) -> usize
pub const fn max_in_flight_batches(&self) -> usize
Return the configured pipeline-owned batch limit.
Sourcepub fn usage(&self) -> ResourceUsage
pub fn usage(&self) -> ResourceUsage
Obtain an accounting snapshot for tests, diagnostics, and stream status.
Trait Implementations§
Source§impl Clone for ResourceBudget
impl Clone for ResourceBudget
Source§fn clone(&self) -> ResourceBudget
fn clone(&self) -> ResourceBudget
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ResourceBudget
impl RefUnwindSafe for ResourceBudget
impl Send for ResourceBudget
impl Sync for ResourceBudget
impl Unpin for ResourceBudget
impl UnsafeUnpin for ResourceBudget
impl UnwindSafe for ResourceBudget
Blanket Implementations§
impl<T> Allocation for T
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