Struct Request

Source
pub struct Request<T> { /* private fields */ }
Expand description

A hRPC request.

Implementations§

Source§

impl<T> Request<T>

Source

pub fn header_map(&self) -> Option<&HeaderMap>

Get an immutable reference to the header map.

Source

pub fn header_map_mut(&mut self) -> Option<&mut HeaderMap>

Get a mutable reference to the header map.

Source

pub fn get_or_insert_header_map(&mut self) -> &mut HeaderMap

Get a mutable reference to the header map, inserting a new one if it doesn’t already exist.

Source

pub fn http_extensions(&self) -> Option<&Extensions>

Get an immutable reference to the HTTP extensions.

Source

pub fn http_extensions_mut(&mut self) -> Option<&mut Extensions>

Get a mutable reference to the HTTP extensions.

Source

pub fn get_or_insert_http_extensions(&mut self) -> &mut Extensions

Get a mutable reference to the HTTP extensions, inserting a new one if it doesn’t already exist.

Source§

impl<T> Request<T>

Source

pub fn http_method(&self) -> Option<&Method>

Get an immutable reference to the HTTP method.

Source

pub fn http_version(&self) -> Option<&Version>

Get an immutable reference to the HTTP version.

Source

pub fn http_uri(&self) -> Option<&Uri>

Get an immutable reference to the HTTP URI.

Source§

impl Request<()>

Source

pub fn empty() -> Request<()>

Create a request with an empty body.

This is useful for hRPC socket requests, since they don’t send any messages.

Source§

impl<T> Request<T>

Source

pub fn new_with_body(body: Body) -> Self

Creates a new request using the provided body.

Source

pub fn extensions_mut(&mut self) -> &mut Extensions

Get a mutable reference to the extensions of this response.

Source

pub fn extensions(&self) -> &Extensions

Get an immutable reference to the extensions of this response.

Source

pub fn endpoint_mut(&mut self) -> &mut Cow<'static, str>

Get a mutable reference to the endpoint of this response.

Source

pub fn endpoint(&self) -> &str

Get an immutable reference to the endpoint of this response.

Source§

impl<T: PbMsg> Request<T>

Source

pub fn new(msg: &T) -> Self

Create a new request with the specified message.

Source§

impl<T: PbMsg + Default> Request<T>

Source

pub async fn into_message(self) -> Result<T, DecodeBodyError>

Extract the body from the request and decode it into the message.

Trait Implementations§

Source§

impl<T> Debug for Request<T>

Source§

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

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

impl<T> From<Parts> for Request<T>

Source§

fn from(parts: Parts) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Request<T>> for Parts

Source§

fn from(req: Request<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> IntoRequest<T> for Request<T>

Source§

fn into_request(self) -> Request<T>

Convert this to a hRPC request.
Source§

impl<S, Err> Service<Request<()>> for Backoff<S>
where S: Service<BoxRequest, Error = TransportError<Err>> + Clone,

Source§

type Response = <S as Service<Request<()>>>::Response

Responses given by the service.
Source§

type Error = <S as Service<Request<()>>>::Error

Errors produced by the service.
Source§

type Future = BackoffFuture<Err, S>

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: BoxRequest) -> Self::Future

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

impl Service<Request<()>> for BoxedTransport

Source§

type Response = Response<()>

Responses given by the service.
Source§

type Error = TransportError<BoxedTransportError>

Errors produced by the service.
Source§

type Future = Pin<Box<dyn Future<Output = Result<<BoxedTransport as Service<Request<()>>>::Response, <BoxedTransport as Service<Request<()>>>::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: BoxRequest) -> Self::Future

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

impl<ToStatus, S> Service<Request<()>> for ErrorIdentifierToStatus<ToStatus, S>
where S: Service<BoxRequest, Response = BoxResponse>, ToStatus: Fn(&str) -> Option<StatusCode> + Clone,

Source§

type Response = Response<()>

Responses given by the service.
Source§

type Error = <S as Service<Request<()>>>::Error

Errors produced by the service.
Source§

type Future = ErrorIdentifierToStatusFuture<ToStatus, <S as Service<Request<()>>>::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: BoxRequest) -> Self::Future

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

impl Service<Request<()>> for HrpcService

Source§

type Response = Response<()>

Responses given by the service.
Source§

type Error = Infallible

Errors produced by the service.
Source§

type Future = Pin<Box<dyn Future<Output = Result<Response<()>, Infallible>> + 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: BoxRequest) -> Self::Future

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

impl Service<Request<()>> for Hyper

Source§

type Response = Response<()>

Responses given by the service.
Source§

type Error = TransportError<HyperError>

Errors produced by the service.
Source§

type Future = HyperCallFuture

The future response value.
Source§

fn poll_ready(&mut self, _: &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: BoxRequest) -> Self::Future

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

impl Service<Request<()>> for Mock

Source§

type Response = Response<()>

Responses given by the service.
Source§

type Error = TransportError<MockError>

Errors produced by the service.
Source§

type Future = MockCallFuture

The future response value.
Source§

fn poll_ready(&mut self, _: &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: BoxRequest) -> Self::Future

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

impl<ModifyReq, ModifyResp, S> Service<Request<()>> for Modify<ModifyReq, ModifyResp, S>
where S: Service<BoxRequest, Response = BoxResponse>, ModifyReq: Fn(&mut BoxRequest), ModifyResp: Fn(&mut BoxResponse) + Clone,

Source§

type Response = Response<()>

Responses given by the service.
Source§

type Error = <S as Service<Request<()>>>::Error

Errors produced by the service.
Source§

type Future = ModifyFuture<ModifyResp, <S as Service<Request<()>>>::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: BoxRequest) -> Self::Future

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

impl<S, ExtractKey, BypassForKey, Key> Service<Request<()>> for RateLimit<S, ExtractKey, BypassForKey, Key>
where S: Service<BoxRequest, Response = BoxResponse, Error = Infallible>, ExtractKey: Fn(&mut BoxRequest) -> Option<Key>, BypassForKey: Fn(&Key) -> bool, Key: Eq + Hash,

Source§

type Response = <S as Service<Request<()>>>::Response

Responses given by the service.
Source§

type Error = <S as Service<Request<()>>>::Error

Errors produced by the service.
Source§

type Future = RateLimitFuture<<S as Service<Request<()>>>::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, request: BoxRequest) -> Self::Future

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

impl Service<Request<()>> for RoutesFinalized

Source§

type Response = Response<()>

Responses given by the service.
Source§

type Error = Infallible

Errors produced by the service.
Source§

type Future = Pin<Box<dyn Future<Output = Result<Response<()>, Infallible>> + 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: BoxRequest) -> Self::Future

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

impl<S, SpanFn, OnRequestFn, OnSuccessFn, OnErrorFn> Service<Request<()>> for Trace<S, SpanFn, OnRequestFn, OnSuccessFn, OnErrorFn>
where S: Service<BoxRequest, Response = BoxResponse>, SpanFn: Fn(&BoxRequest) -> Span, OnRequestFn: Fn(&BoxRequest, &Span), OnSuccessFn: Fn(&BoxResponse, &Span) + Clone, OnErrorFn: Fn(&BoxResponse, &Span, &Error) + Clone,

Source§

type Response = <S as Service<Request<()>>>::Response

Responses given by the service.
Source§

type Error = <S as Service<Request<()>>>::Error

Errors produced by the service.
Source§

type Future = TraceFuture<<S as Service<Request<()>>>::Future, OnSuccessFn, OnErrorFn>

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: BoxRequest) -> Self::Future

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

impl Service<Request<()>> for Wasm

Source§

type Response = Response<()>

Responses given by the service.
Source§

type Error = TransportError<WasmError>

Errors produced by the service.
Source§

type Future = CallFuture

The future response value.
Source§

fn poll_ready(&mut self, _: &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: BoxRequest) -> Self::Future

Process the request and return the response asynchronously. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Request<T>

§

impl<T> !RefUnwindSafe for Request<T>

§

impl<T> Send for Request<T>
where T: Send,

§

impl<T> Sync for Request<T>
where T: Sync,

§

impl<T> Unpin for Request<T>
where T: Unpin,

§

impl<T> !UnwindSafe for Request<T>

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> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

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<T> ErasedDestructor for T
where T: 'static,