pub struct BackpressureConsumer { /* private fields */ }Expand description
A consumer that releases credits back to the pool as items are processed.
Implementations§
Source§impl BackpressureConsumer
impl BackpressureConsumer
Sourcepub fn new(pool: CreditPool) -> Self
pub fn new(pool: CreditPool) -> Self
Create a consumer that shares the given CreditPool.
Sourcepub fn consume(&mut self, credits: i64)
pub fn consume(&mut self, credits: i64)
Mark credits worth of processing as complete, releasing those credits
back to the pool so the producer can emit more items.
Sourcepub fn consumed_total(&self) -> u64
pub fn consumed_total(&self) -> u64
Total items consumed (i.e. times consume() was called) since creation.
Sourcepub fn pool(&self) -> &CreditPool
pub fn pool(&self) -> &CreditPool
Shared reference to the underlying credit pool.
Auto Trait Implementations§
impl Freeze for BackpressureConsumer
impl RefUnwindSafe for BackpressureConsumer
impl Send for BackpressureConsumer
impl Sync for BackpressureConsumer
impl Unpin for BackpressureConsumer
impl UnsafeUnpin for BackpressureConsumer
impl UnwindSafe for BackpressureConsumer
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