Skip to main content

BytePermits

Trait BytePermits 

Source
pub trait BytePermits: Send + Sync {
    // Required method
    fn acquire<'life0, 'async_trait>(
        &'life0 self,
        n_bytes: usize,
    ) -> Pin<Box<dyn Future<Output = Permit> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Backpressure permit trait.

Implementations control write pump flow based on byte counts.

Required Methods§

Source

fn acquire<'life0, 'async_trait>( &'life0 self, n_bytes: usize, ) -> Pin<Box<dyn Future<Output = Permit> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Acquire permission to write n_bytes.

This may block if the system is under memory pressure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§