pub struct TowerUpstream<S, ReqBody, ResBody> { /* private fields */ }Expand description
Adapter that implements Hitbox’s Upstream trait for Tower services.
TowerUpstream bridges the gap between Tower’s Service trait and Hitbox’s
Upstream trait. It converts CacheableHttpRequest to http::Request
for the service call, and wraps responses in CacheableHttpResponse.
§When You’ll Encounter This
You typically don’t create this directly. It’s used internally by
CacheService to call the upstream service
on cache misses.
§Type Parameters
S- The Tower service being adaptedReqBody- Request body typeResBody- Response body type
Implementations§
Source§impl<S, ReqBody, ResBody> TowerUpstream<S, ReqBody, ResBody>
impl<S, ReqBody, ResBody> TowerUpstream<S, ReqBody, ResBody>
Trait Implementations§
Source§impl<S, ReqBody, ResBody> Upstream<CacheableHttpRequest<ReqBody>> for TowerUpstream<S, ReqBody, ResBody>
impl<S, ReqBody, ResBody> Upstream<CacheableHttpRequest<ReqBody>> for TowerUpstream<S, ReqBody, ResBody>
Source§type Response = Result<CacheableHttpResponse<ResBody>, <S as Service<Request<BufferedBody<ReqBody>>>>::Error>
type Response = Result<CacheableHttpResponse<ResBody>, <S as Service<Request<BufferedBody<ReqBody>>>>::Error>
The response type returned by the upstream service
Source§type Future = TowerUpstreamFuture<<S as Service<Request<BufferedBody<ReqBody>>>>::Future, ResBody, <S as Service<Request<BufferedBody<ReqBody>>>>::Error>
type Future = TowerUpstreamFuture<<S as Service<Request<BufferedBody<ReqBody>>>>::Future, ResBody, <S as Service<Request<BufferedBody<ReqBody>>>>::Error>
The future that resolves to the response
Source§fn call(&mut self, req: CacheableHttpRequest<ReqBody>) -> Self::Future
fn call(&mut self, req: CacheableHttpRequest<ReqBody>) -> Self::Future
Call the upstream service with the given request
Auto Trait Implementations§
impl<S, ReqBody, ResBody> Freeze for TowerUpstream<S, ReqBody, ResBody>where
S: Freeze,
impl<S, ReqBody, ResBody> RefUnwindSafe for TowerUpstream<S, ReqBody, ResBody>
impl<S, ReqBody, ResBody> Send for TowerUpstream<S, ReqBody, ResBody>
impl<S, ReqBody, ResBody> Sync for TowerUpstream<S, ReqBody, ResBody>
impl<S, ReqBody, ResBody> Unpin for TowerUpstream<S, ReqBody, ResBody>
impl<S, ReqBody, ResBody> UnwindSafe for TowerUpstream<S, ReqBody, ResBody>
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