Struct actix_web::dev::WebService [−][src]
pub struct WebService { /* fields omitted */ }
Implementations
Create new WebService
instance.
Add match guard to a web service.
use actix_web::{web, guard, dev, App, Error, HttpResponse};
async fn index(req: dev::ServiceRequest) -> Result<dev::ServiceResponse, Error> {
Ok(req.into_response(HttpResponse::Ok().finish()))
}
fn main() {
let app = App::new()
.service(
web::service("/app")
.guard(guard::Header("content-type", "text/plain"))
.finish(index)
);
}
pub fn finish<T, F>(self, service: F) -> impl HttpServiceFactory where
F: IntoServiceFactory<T>,
T: ServiceFactory<Config = (), Request = ServiceRequest, Response = ServiceResponse, Error = Error, InitError = ()> + 'static,
pub fn finish<T, F>(self, service: F) -> impl HttpServiceFactory where
F: IntoServiceFactory<T>,
T: ServiceFactory<Config = (), Request = ServiceRequest, Response = ServiceResponse, Error = Error, InitError = ()> + 'static,
Set a service factory implementation and generate web service.
Auto Trait Implementations
impl !RefUnwindSafe for WebService
impl !Send for WebService
impl !Sync for WebService
impl Unpin for WebService
impl !UnwindSafe for WebService
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more