pub struct ServiceBackend { /* private fields */ }Available on crate feature
tower only.Expand description
Wraps a Tower Service as an HttpBackend.
Buffered requests use the Tower stack. HttpBackend::execute_stream delegates to a
separate ReqwestBackend (same reqwest client as ClientBuilder::transport_stack).
Tower request middleware does not apply to the streaming path.
Implementations§
Source§impl ServiceBackend
impl ServiceBackend
Sourcepub fn new<S>(service: S, streaming: ReqwestBackend) -> Selfwhere
S: Service<HttpRequest, Response = HttpResponse, Error = Error> + Clone + Send + 'static,
S::Future: Send + 'static,
pub fn new<S>(service: S, streaming: ReqwestBackend) -> Selfwhere
S: Service<HttpRequest, Response = HttpResponse, Error = Error> + Clone + Send + 'static,
S::Future: Send + 'static,
Wraps a Tower service and a reqwest backend used for streaming responses.
Sourcepub fn from_box(service: BoxHttpService, streaming: ReqwestBackend) -> Self
pub fn from_box(service: BoxHttpService, streaming: ReqwestBackend) -> Self
Wraps an already-boxed transport stack with a streaming backend.
Sourcepub fn clone_inner(&self) -> BoxHttpService
pub fn clone_inner(&self) -> BoxHttpService
Returns a clone of the inner transport stack (for advanced testing).
Sourcepub fn streaming_backend(&self) -> &ReqwestBackend
pub fn streaming_backend(&self) -> &ReqwestBackend
Returns the reqwest backend used for HttpBackend::execute_stream.
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