pub struct DropContextService<T, C>where
    C: Send + 'static,{ /* private fields */ }
Expand description

Swagger Middleware that wraps a hyper::service::Service and drops any contextual information on the request. Servers will normally want to use DropContextMakeService, which will create a DropContextService to handle each connection, while clients can simply wrap a hyper::Client in the middleware.

Client Usage


let client = hyper::Client::new();
let mut client = DropContextService::new(client);
let request = (hyper::Request::get("http://www.google.com").body(hyper::Body::empty()).unwrap());
let context = "Some Context".to_string();

let response = client.call((request, context));

Implementations§

source§

impl<T, C> DropContextService<T, C>where C: Send + 'static,

source

pub fn new(inner: T) -> Self

Create a new DropContextService struct wrapping a value

Trait Implementations§

source§

impl<T: Clone, C> Clone for DropContextService<T, C>where C: Send + 'static + Clone,

source§

fn clone(&self) -> DropContextService<T, C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug, C> Debug for DropContextService<T, C>where C: Send + 'static + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Inner, Body, Context> Service<(Request<Body>, Context)> for DropContextService<Inner, Context>where Context: Send + 'static, Inner: Service<Request<Body>>,

§

type Response = <Inner as Service<Request<Body>>>::Response

Responses given by the service.
§

type Error = <Inner as Service<Request<Body>>>::Error

Errors produced by the service.
§

type Future = <Inner as Service<Request<Body>>>::Future

The future response value.
source§

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
source§

fn call(&mut self, (req, _): (Request<Body>, Context)) -> Self::Future

Process the request and return the response asynchronously. Read more

Auto Trait Implementations§

§

impl<T, C> RefUnwindSafe for DropContextService<T, C>where C: RefUnwindSafe, T: RefUnwindSafe,

§

impl<T, C> Send for DropContextService<T, C>where T: Send,

§

impl<T, C> Sync for DropContextService<T, C>where C: Sync, T: Sync,

§

impl<T, C> Unpin for DropContextService<T, C>where C: Unpin, T: Unpin,

§

impl<T, C> UnwindSafe for DropContextService<T, C>where C: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, S, F, Target, ReqBody, ResBody, Error, MakeError> CompositedMakeService<Target, ReqBody, ResBody, Error, MakeError> for Twhere Target: Send, T: Service<Target, Response = S, Future = F, Error = MakeError> + Send, F: Future<Output = Result<S, MakeError>> + Send + 'static, S: CompositedService<ReqBody, ResBody, Error> + Send + 'static,

source§

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), MakeError>>

Available on crate feature server and (crate features http1 or http2) only.
See tower_service::Service::poll_ready
source§

fn call( &mut self, target: Target ) -> Pin<Box<dyn Future<Output = Result<Box<dyn CompositedService<ReqBody, ResBody, Error> + Send, Global>, MakeError>> + Send, Global>>

Available on crate feature server and (crate features http1 or http2) only.
See tower_service::Service::call
source§

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices

§

type Remainder = Choices

source§

fn subset( self ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U, I> LiftInto<U, I> for Twhere U: LiftFrom<T, I>,

source§

fn lift_into(self) -> U

Performs the indexed conversion.
source§

impl<Source> Sculptor<HNil, HNil> for Source

§

type Remainder = Source

source§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Typeable for Twhere T: Any,

§

fn get_type(&self) -> TypeId

Get the TypeId of this object.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<ReqB, ResB, Context, T> SwaggerService<ReqB, ResB, Context> for Twhere T: Clone + Service<(Request<ReqB>, Context), Response = Response<ResB>, Error = Error, Future = Pin<Box<dyn Future<Output = Result<Response<ResB>, Error>>, Global>>>, Context: Has<Option<AuthData>> + Has<Option<Authorization>> + Has<XSpanIdString> + Clone + 'static + Send,