[][src]Struct webtonic_server::Router

pub struct Router<A, B> { /* fields omitted */ }

A Router is used to compile Routes, by adding services.

Implementations

impl<A, B> Router<A, B>[src]

pub fn add_service<C>(self, service: C) -> Router<C, Route<A, B>> where
    C: Service<Request<BoxBody>, Response = Response<BoxBody>, Error = Never>, 
[src]

Add a Service to the route (see example).

Arguments

Returns

  • A new Router, which included the old routes and the new service.

pub async fn serve<U>(self, addr: U) where
    U: Into<SocketAddr>,
    A: Service<Request<BoxBody>, Response = Response<BoxBody>, Error = Never> + NamedService + Clone + Send + Sync + 'static,
    A::Future: Send + 'static,
    B: Service<(String, Request<BoxBody>), Response = Response<BoxBody>, Error = Never> + Clone + Send + Sync + 'static,
    B::Future: Send + 'static, 
[src]

Start serving the endpoint on the provided addres (see example).

Arguments

  • addr: The address on which to serve the endpoint.

Returns

  • It doens't.

Trait Implementations

impl<A: Clone, B: Clone> Clone for Router<A, B>[src]

impl<A: Debug, B: Debug> Debug for Router<A, B>[src]

Auto Trait Implementations

impl<A, B> RefUnwindSafe for Router<A, B> where
    A: RefUnwindSafe,
    B: RefUnwindSafe

impl<A, B> Send for Router<A, B> where
    A: Send,
    B: Send

impl<A, B> Sync for Router<A, B> where
    A: Sync,
    B: Sync

impl<A, B> Unpin for Router<A, B> where
    A: Unpin,
    B: Unpin

impl<A, B> UnwindSafe for Router<A, B> where
    A: UnwindSafe,
    B: UnwindSafe

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> IntoRequest<T> for T[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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>, 

impl<T> WithSubscriber for T[src]