[][src]Struct actix_web::dev::WebService

pub struct WebService { /* fields omitted */ }

Implementations

impl WebService[src]

pub fn new<T: IntoPattern>(path: T) -> Self[src]

Create new WebService instance.

pub fn name(self, name: &str) -> Self[src]

Set service name.

Name is used for url generation.

pub fn guard<G: Guard + 'static>(self, guard: G) -> Self[src]

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, 
[src]

Set a service factory implementation and generate web service.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,