hyperdriver::service

Struct ExecuteRequest

Source
pub struct ExecuteRequest<C: Connection<B> + PoolableConnection, B> { /* private fields */ }
Available on crate feature client only.
Expand description

Couples the connection with the http request.

This allows downstream services to access both the request and connection – they are needed in tandem to send the request. This also means that middleware can implement tower::Service on tower::Service<ExecuteRequest<C, B>> to modify the request before it is sent in the context of the connection.

See crate::service::SetHostHeader for an example of a middleware that modifies the request before it is sent in the context of the connection.

Implementations§

Source§

impl<C: Connection<B> + PoolableConnection, B> ExecuteRequest<C, B>

Source

pub fn new(conn: Pooled<C>, request: Request<B>) -> Self

Create a new request

Source

pub fn into_parts(self) -> (Pooled<C>, Request<B>)

Split the request into its parts.

Source

pub fn connection(&self) -> &C

A reference to the connection.

Source

pub fn request(&self) -> &Request<B>

A reference to the request.

Source

pub fn request_mut(&mut self) -> &mut Request<B>

A mutable reference to the request.

Trait Implementations§

Source§

impl<C: Debug + Connection<B> + PoolableConnection, B: Debug> Debug for ExecuteRequest<C, B>

Source§

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

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

impl<S, C, B> Service<ExecuteRequest<C, B>> for Http1ChecksService<S, C, B>
where S: Service<ExecuteRequest<C, B>, Error = Error>, C: Connection<B> + PoolableConnection,

Source§

type Response = <S as Service<ExecuteRequest<C, B>>>::Response

Responses given by the service.
Source§

type Error = <S as Service<ExecuteRequest<C, B>>>::Error

Errors produced by the service.
Source§

type Future = MaybeErrorFuture<<S as Service<ExecuteRequest<C, B>>>::Future, <S as Service<ExecuteRequest<C, B>>>::Response, <S as Service<ExecuteRequest<C, B>>>::Error>

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: ExecuteRequest<C, B>) -> Self::Future

Process the request and return the response asynchronously. Read more
Source§

impl<S, C, B> Service<ExecuteRequest<C, B>> for Http2ChecksService<S, C, B>
where S: Service<ExecuteRequest<C, B>, Error = Error>, C: Connection<B> + PoolableConnection,

Source§

type Response = <S as Service<ExecuteRequest<C, B>>>::Response

Responses given by the service.
Source§

type Error = <S as Service<ExecuteRequest<C, B>>>::Error

Errors produced by the service.
Source§

type Future = MaybeErrorFuture<<S as Service<ExecuteRequest<C, B>>>::Future, <S as Service<ExecuteRequest<C, B>>>::Response, <S as Service<ExecuteRequest<C, B>>>::Error>

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: ExecuteRequest<C, B>) -> Self::Future

Process the request and return the response asynchronously. Read more
Source§

impl<C, B> Service<ExecuteRequest<C, B>> for RequestExecutor<C, B>
where C: Connection<B> + PoolableConnection, B: Body + Unpin + Send + 'static,

Source§

type Response = Response<<C as Connection<B>>::ResBody>

Responses given by the service.
Source§

type Error = Error

Errors produced by the service.
Source§

type Future = Pin<Box<dyn Future<Output = Result<<RequestExecutor<C, B> as Service<ExecuteRequest<C, B>>>::Response, <RequestExecutor<C, B> as Service<ExecuteRequest<C, B>>>::Error>> + Send>>

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: ExecuteRequest<C, B>) -> Self::Future

Process the request and return the response asynchronously. Read more
Source§

impl<S, B, C> Service<ExecuteRequest<C, B>> for SetHostHeader<S>

Source§

type Response = <S as Service<ExecuteRequest<C, B>>>::Response

Responses given by the service.
Source§

type Error = <S as Service<ExecuteRequest<C, B>>>::Error

Errors produced by the service.
Source§

type Future = <S as Service<ExecuteRequest<C, B>>>::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: ExecuteRequest<C, B>) -> Self::Future

Process the request and return the response asynchronously. Read more

Auto Trait Implementations§

§

impl<C, B> !Freeze for ExecuteRequest<C, B>

§

impl<C, B> !RefUnwindSafe for ExecuteRequest<C, B>

§

impl<C, B> Send for ExecuteRequest<C, B>
where B: Send,

§

impl<C, B> Sync for ExecuteRequest<C, B>
where B: Sync, C: Sync,

§

impl<C, B> Unpin for ExecuteRequest<C, B>
where B: Unpin,

§

impl<C, B> !UnwindSafe for ExecuteRequest<C, B>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. 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 T
where 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
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<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,