pub struct ServiceBackend { /* private fields */ }Available on crate feature
tower only.Expand description
Wraps Tower Service stacks as an HttpBackend.
Both buffered and streaming paths run through Tower middleware when configured via
ClientBuilder::transport_stack.
Implementations§
Source§impl ServiceBackend
impl ServiceBackend
Sourcepub fn new<B, S>(buffered: B, streaming: S) -> Selfwhere
B: Service<HttpRequest, Response = HttpResponse, Error = Error> + Clone + Send + 'static,
B::Future: Send + 'static,
S: Service<HttpRequest, Response = HttpStreamingResponse, Error = Error> + Clone + Send + 'static,
S::Future: Send + 'static,
pub fn new<B, S>(buffered: B, streaming: S) -> Selfwhere
B: Service<HttpRequest, Response = HttpResponse, Error = Error> + Clone + Send + 'static,
B::Future: Send + 'static,
S: Service<HttpRequest, Response = HttpStreamingResponse, Error = Error> + Clone + Send + 'static,
S::Future: Send + 'static,
Wraps buffered and streaming Tower services.
Sourcepub fn from_boxes(
buffered: BoxHttpService,
streaming: BoxStreamingHttpService,
) -> Self
pub fn from_boxes( buffered: BoxHttpService, streaming: BoxStreamingHttpService, ) -> Self
Wraps already-boxed buffered and streaming transport stacks.
Sourcepub fn buffered_with_reqwest_streaming<S>(service: S, client: Client) -> Selfwhere
S: Service<HttpRequest, Response = HttpResponse, Error = Error> + Clone + Send + 'static,
S::Future: Send + 'static,
pub fn buffered_with_reqwest_streaming<S>(service: S, client: Client) -> Selfwhere
S: Service<HttpRequest, Response = HttpResponse, Error = Error> + Clone + Send + 'static,
S::Future: Send + 'static,
Buffered Tower stack + plain reqwest streaming (legacy).
Sourcepub fn new_buffered_only<S>(service: S, client: Client) -> Selfwhere
S: Service<HttpRequest, Response = HttpResponse, Error = Error> + Clone + Send + 'static,
S::Future: Send + 'static,
👎Deprecated: use from_boxes or transport_stack which wires both paths
pub fn new_buffered_only<S>(service: S, client: Client) -> Selfwhere
S: Service<HttpRequest, Response = HttpResponse, Error = Error> + Clone + Send + 'static,
S::Future: Send + 'static,
use from_boxes or transport_stack which wires both paths
Wraps a Tower service and a reqwest backend used for streaming responses.
Sourcepub fn from_box(service: BoxHttpService, client: Client) -> Self
👎Deprecated: use from_boxes
pub fn from_box(service: BoxHttpService, client: Client) -> Self
use from_boxes
Wraps an already-boxed transport stack with reqwest-only streaming.
Sourcepub fn clone_inner(&self) -> BoxHttpService
pub fn clone_inner(&self) -> BoxHttpService
Returns a clone of the inner transport stack (for advanced testing).
Trait Implementations§
Source§impl Clone for ServiceBackend
impl Clone for ServiceBackend
Source§impl HttpBackend for ServiceBackend
impl HttpBackend for ServiceBackend
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes one HTTP request and returns the fully buffered response.
Source§fn execute_stream<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpStreamingResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute_stream<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpStreamingResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes one HTTP request and returns a streaming response body.
Auto Trait Implementations§
impl Freeze for ServiceBackend
impl RefUnwindSafe for ServiceBackend
impl Send for ServiceBackend
impl Sync for ServiceBackend
impl Unpin for ServiceBackend
impl UnsafeUnpin for ServiceBackend
impl UnwindSafe for ServiceBackend
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