Trait swagger::context::Pop
[−]
[src]
pub trait Pop<T> { type Result; fn pop(self) -> (T, Self::Result); }
Defines a method for permanently extracting a value, changing the resulting type. Used to specify that a hyper service consumes some data from the context, making it unavailable to later layers, e.g.
struct MyItem1; struct MyItem2; struct MyItem3; struct MiddlewareService<T, C> { inner: T, marker: PhantomData<C>, } impl<T, C, D, E> hyper::server::Service for MiddlewareService<T, C> where C: Pop<MyItem1, Result=D>, D: Pop<MyItem2, Result=E>, E: Pop<MyItem3>, T: hyper::server::Service<Request = (hyper::Request, E::Result)> { type Request = (hyper::Request, C); type Response = T::Response; type Error = T::Error; type Future = T::Future; fn call(&self, (req, context) : Self::Request) -> Self::Future { // type annotations optional, included for illustrative purposes let (_, context): (MyItem1, D) = context.pop(); let (_, context): (MyItem2, E) = context.pop(); let (_, context): (MyItem3, E::Result) = context.pop(); self.inner.call((req, context)) } }
Associated Types
type Result
The type that remains after the value has been popped.
Required Methods
Implementors
impl<T, C> Pop<T> for ContextBuilder<T, C> type Result = C;
impl<C> Pop<XSpanIdString> for ContextBuilder<Option<AuthData>, C> where
C: Pop<XSpanIdString>, type Result = ContextBuilder<Option<AuthData>, C::Result>;impl<C> Pop<Option<AuthData>> for ContextBuilder<XSpanIdString, C> where
C: Pop<Option<AuthData>>, type Result = ContextBuilder<XSpanIdString, C::Result>;impl<C> Pop<XSpanIdString> for ContextBuilder<Option<Authorization>, C> where
C: Pop<XSpanIdString>, type Result = ContextBuilder<Option<Authorization>, C::Result>;impl<C> Pop<Option<Authorization>> for ContextBuilder<XSpanIdString, C> where
C: Pop<Option<Authorization>>, type Result = ContextBuilder<XSpanIdString, C::Result>;impl<C> Pop<Option<AuthData>> for ContextBuilder<Option<Authorization>, C> where
C: Pop<Option<AuthData>>, type Result = ContextBuilder<Option<Authorization>, C::Result>;impl<C> Pop<Option<Authorization>> for ContextBuilder<Option<AuthData>, C> where
C: Pop<Option<Authorization>>, type Result = ContextBuilder<Option<AuthData>, C::Result>;