Struct BufferLayer
struct BufferLayer<Request> { ... }
Adds an mpsc buffer in front of an inner service.
The default Tokio executor is used to run the given service, which means that this layer can only be used on the Tokio runtime.
See the module documentation for more details.
Implementations
impl<Request> BufferLayer<Request>
const fn new(bound: usize) -> SelfCreates a new
BufferLayerwith the providedbound.boundgives the maximal number of requests that can be queued for the service before backpressure is applied to callers.A note on choosing a
boundWhen
Buffer's implementation ofpoll_readyreturnsPoll::Ready, it reserves a slot in the channel for the forthcomingcall. However, if this call doesn't arrive, this reserved slot may be held up for a long time. As a result, it's advisable to setboundto be at least the maximum number of concurrent requests theBufferwill see. If you do not, all the slots in the buffer may be held up by futures that have just calledpoll_readybut will not issue acall, which prevents other senders from issuing new requests.
impl<Request> Clone for BufferLayer<Request>
fn clone(self: &Self) -> Self
impl<Request> Copy for BufferLayer<Request>
impl<Request> Debug for BufferLayer<Request>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<Request> Freeze for BufferLayer<Request>
impl<Request> RefUnwindSafe for BufferLayer<Request>
impl<Request> Send for BufferLayer<Request>
impl<Request> Sync for BufferLayer<Request>
impl<Request> Unpin for BufferLayer<Request>
impl<Request> UnsafeUnpin for BufferLayer<Request>
impl<Request> UnwindSafe for BufferLayer<Request>
impl<S, Request> Layer for BufferLayer<Request>
fn layer(self: &Self, service: S) -> <Self as >::Service
impl<T> Any for BufferLayer<Request>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for BufferLayer<Request>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for BufferLayer<Request>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for BufferLayer<Request>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for BufferLayer<Request>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for BufferLayer<Request>
impl<T> ToOwned for BufferLayer<Request>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> WithSubscriber for BufferLayer<Request>
impl<T, U> Into for BufferLayer<Request>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for BufferLayer<Request>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for BufferLayer<Request>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>