Skip to main content

with_buffer

Function with_buffer 

Source
pub fn with_buffer(client: Client, capacity: usize) -> BoxHttpService
Available on crate feature tower only.
Expand description

Wraps the reqwest inner service with tower::buffer::Buffer.

Use when the inner service is not Clone or cloning it is expensive. Buffer::new spawns a worker on the Tokio runtime; lightweight Buffer clones enqueue work to that worker. This is optional for typical reqwest-backed stacks — ServiceBackend already clones the boxed stack per request.