Struct actix_web::dev::ServiceRequest [−][src]
An service http request
ServiceRequest allows mutable access to request’s internal structures
Implementations
impl ServiceRequest
[src]
pub fn into_parts(self) -> (HttpRequest, Payload)
[src]
Deconstruct request into parts
pub fn from_parts(req: HttpRequest, payload: Payload) -> Self
[src]
Construct request from parts.
pub fn from_request(req: HttpRequest) -> Self
[src]
Construct request from request.
The returned ServiceRequest
would have no payload.
pub fn into_response<B, R: Into<Response<B>>>(
self,
res: R
) -> ServiceResponse<B>
[src]
self,
res: R
) -> ServiceResponse<B>
Create service response
pub fn error_response<B, E: Into<Error>>(self, err: E) -> ServiceResponse<B>
[src]
Create service response for error
pub fn head(&self) -> &RequestHead
[src]
This method returns reference to the request head
pub fn head_mut(&mut self) -> &mut RequestHead
[src]
This method returns reference to the request head
pub fn uri(&self) -> &Uri
[src]
Request’s uri.
pub fn method(&self) -> &Method
[src]
Read the Request method.
pub fn version(&self) -> Version
[src]
Read the Request Version.
pub fn headers(&self) -> &HeaderMap
[src]
Returns request’s headers.
pub fn headers_mut(&mut self) -> &mut HeaderMap
[src]
Returns mutable request’s headers.
pub fn path(&self) -> &str
[src]
The target path of this Request.
pub fn query_string(&self) -> &str
[src]
The query string in the URL.
E.g., id=10
pub fn peer_addr(&self) -> Option<SocketAddr>
[src]
Peer socket address.
Peer address is the directly connected peer’s socket address. If a proxy is used in front of the Actix Web server, then it would be address of this proxy.
To get client connection information ConnectionInfo
should be used.
Will only return None when called in unit tests.
pub fn connection_info(&self) -> Ref<'_, ConnectionInfo>
[src]
Get ConnectionInfo for the current request.
pub fn match_info(&self) -> &Path<Url>
[src]
Get a reference to the Path parameters.
Params is a container for url parameters.
A variable segment is specified in the form {identifier}
,
where the identifier can be used later in a request handler to
access the matched value for that segment.
pub fn match_name(&self) -> Option<&str>
[src]
Counterpart to HttpRequest::match_name
.
pub fn match_pattern(&self) -> Option<String>
[src]
Counterpart to HttpRequest::match_pattern
.
pub fn match_info_mut(&mut self) -> &mut Path<Url>
[src]
Get a mutable reference to the Path parameters.
pub fn resource_map(&self) -> &ResourceMap
[src]
Get a reference to a ResourceMap
of current application.
pub fn app_config(&self) -> &AppConfig
[src]
Service configuration
pub fn app_data<T: 'static>(&self) -> Option<&T>
[src]
Counterpart to HttpRequest::app_data
.
pub fn set_payload(&mut self, payload: Payload)
[src]
Set request payload.
pub fn add_data_container(&mut self, extensions: Rc<Extensions>)
[src]
Add data container to request’s resolution set.
In middleware, prefer extensions_mut
for request-local
data since it is assumed that the same app data is presented for every request.
Trait Implementations
impl Debug for ServiceRequest
[src]
impl HttpMessage for ServiceRequest
[src]
type Stream = PayloadStream
Type of message payload stream
fn headers(&self) -> &HeaderMap
[src]
Returns Request’s headers.
fn extensions(&self) -> Ref<'_, Extensions>
[src]
Request extensions
fn extensions_mut(&self) -> RefMut<'_, Extensions>
[src]
Mutable reference to a the request’s extensions
fn take_payload(&mut self) -> Payload<Self::Stream>
[src]
pub fn content_type(&self) -> &str
[src]
pub fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>
[src]
pub fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>
[src]
pub fn chunked(&self) -> Result<bool, ParseError>
[src]
pub fn cookies(
&self
) -> Result<Ref<'_, Vec<Cookie<'static>, Global>>, ParseError>
[src]
&self
) -> Result<Ref<'_, Vec<Cookie<'static>, Global>>, ParseError>
pub fn cookie(&self, name: &str) -> Option<Cookie<'static>>
[src]
impl<T> IntoServiceFactory<T, ServiceRequest> for Resource<T> where
T: ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse, Error = Error, InitError = ()>,
[src]
T: ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse, Error = Error, InitError = ()>,
fn into_factory(self) -> T
[src]
impl Resource<Url> for ServiceRequest
[src]
fn resource_path(&mut self) -> &mut Path<Url>
[src]
impl ServiceFactory<ServiceRequest> for Route
[src]
type Response = ServiceResponse
Responses given by the created services.
type Error = Error
Errors produced by the created services.
type Config = ()
Service factory configuration.
type Service = RouteService
The kind of Service
created by this factory.
type InitError = ()
Errors potentially raised while building a service.
type Future = LocalBoxFuture<'static, Result<Self::Service, Self::InitError>>
The future of the Service
instance.
fn new_service(&self, _: ()) -> Self::Future
[src]
impl<S, B> Transform<S, ServiceRequest> for DefaultHeaders where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
[src]
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
type Response = ServiceResponse<B>
Responses given by the service.
type Error = Error
Errors produced by the service.
type Transform = DefaultHeadersMiddleware<S>
The TransformService
value created by this factory
type InitError = ()
Errors produced while building a transform service.
type Future = Ready<Result<Self::Transform, Self::InitError>>
The future response value.
fn new_transform(&self, service: S) -> Self::Future
[src]
pub fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, Req, F, E> where
F: Fn(Self::InitError) -> E + Clone,
[src]
F: Fn(Self::InitError) -> E + Clone,
impl<S, B> Transform<S, ServiceRequest> for ErrorHandlers<B> where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
S::Future: 'static,
B: 'static,
[src]
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
S::Future: 'static,
B: 'static,
type Response = ServiceResponse<B>
Responses given by the service.
type Error = Error
Errors produced by the service.
type Transform = ErrorHandlersMiddleware<S, B>
The TransformService
value created by this factory
type InitError = ()
Errors produced while building a transform service.
type Future = LocalBoxFuture<'static, Result<Self::Transform, Self::InitError>>
The future response value.
fn new_transform(&self, service: S) -> Self::Future
[src]
pub fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, Req, F, E> where
F: Fn(Self::InitError) -> E + Clone,
[src]
F: Fn(Self::InitError) -> E + Clone,
impl<S, B> Transform<S, ServiceRequest> for Logger where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
B: MessageBody,
[src]
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
B: MessageBody,
type Response = ServiceResponse<StreamLog<B>>
Responses given by the service.
type Error = Error
Errors produced by the service.
type InitError = ()
Errors produced while building a transform service.
type Transform = LoggerMiddleware<S>
The TransformService
value created by this factory
type Future = Ready<Result<Self::Transform, Self::InitError>>
The future response value.
fn new_transform(&self, service: S) -> Self::Future
[src]
pub fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, Req, F, E> where
F: Fn(Self::InitError) -> E + Clone,
[src]
F: Fn(Self::InitError) -> E + Clone,
impl<S, B> Transform<S, ServiceRequest> for NormalizePath where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
[src]
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
type Response = ServiceResponse<B>
Responses given by the service.
type Error = Error
Errors produced by the service.
type Transform = NormalizePathNormalization<S>
The TransformService
value created by this factory
type InitError = ()
Errors produced while building a transform service.
type Future = Ready<Result<Self::Transform, Self::InitError>>
The future response value.
fn new_transform(&self, service: S) -> Self::Future
[src]
pub fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, Req, F, E> where
F: Fn(Self::InitError) -> E + Clone,
[src]
F: Fn(Self::InitError) -> E + Clone,
impl<S, B> Transform<S, ServiceRequest> for Compress where
B: MessageBody,
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
[src]
B: MessageBody,
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
type Response = ServiceResponse<Encoder<B>>
Responses given by the service.
type Error = Error
Errors produced by the service.
type Transform = CompressMiddleware<S>
The TransformService
value created by this factory
type InitError = ()
Errors produced while building a transform service.
type Future = Ready<Result<Self::Transform, Self::InitError>>
The future response value.
fn new_transform(&self, service: S) -> Self::Future
[src]
pub fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, Req, F, E> where
F: Fn(Self::InitError) -> E + Clone,
[src]
F: Fn(Self::InitError) -> E + Clone,
Auto Trait Implementations
impl !RefUnwindSafe for ServiceRequest
impl !Send for ServiceRequest
impl !Sync for ServiceRequest
impl Unpin for ServiceRequest
impl !UnwindSafe for ServiceRequest
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,