Struct actix_web::dev::WebService
source · pub struct WebService { /* private fields */ }
Implementations§
source§impl WebService
impl WebService
sourcepub fn new<T: IntoPatterns>(path: T) -> Self
pub fn new<T: IntoPatterns>(path: T) -> Self
Create new WebService
instance.
sourcepub fn guard<G: Guard + 'static>(self, guard: G) -> Self
pub fn guard<G: Guard + 'static>(self, guard: G) -> Self
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()))
}
let app = App::new()
.service(
web::service("/app")
.guard(guard::Header("content-type", "text/plain"))
.finish(index)
);
sourcepub fn finish<T, F>(self, service: F) -> impl HttpServiceFactorywhere
F: IntoServiceFactory<T, ServiceRequest>,
T: ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse, Error = Error, InitError = ()> + 'static,
pub fn finish<T, F>(self, service: F) -> impl HttpServiceFactorywhere
F: IntoServiceFactory<T, ServiceRequest>,
T: ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse, Error = Error, InitError = ()> + 'static,
Set a service factory implementation and generate web service.
Auto Trait Implementations§
impl Freeze for WebService
impl !RefUnwindSafe for WebService
impl !Send for WebService
impl !Sync for WebService
impl Unpin for WebService
impl !UnwindSafe for WebService
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more