[][src]Struct tonic::transport::server::Router

pub struct Router<A, B> { /* fields omitted */ }
This is supported on feature="transport" only.

A stack based Service router.

Methods

impl<A, B> Router<A, B> where
    A: Service<Request<Body>, Response = Response<BoxBody>> + Clone + Send + 'static,
    A::Future: Send + 'static,
    A::Error: Into<Box<dyn Error + Send + Sync>> + Send,
    B: Service<Request<Body>, Response = Response<BoxBody>> + Clone + Send + 'static,
    B::Future: Send + 'static,
    B::Error: Into<Box<dyn Error + Send + Sync>> + Send
[src]

pub fn add_service<S>(self, svc: S) -> Router<S, Or<A, B, Request<Body>>> where
    S: Service<Request<Body>, Response = Response<BoxBody>> + ServiceName + Clone + Send + 'static,
    S::Future: Send + 'static,
    S::Error: Into<Box<dyn Error + Send + Sync>> + Send
[src]

This is supported on feature="transport" only.

Add a new service to this router.

pub async fn serve(self, addr: SocketAddr) -> Result<(), Error>[src]

This is supported on feature="transport" only.

Consume this Server creating a future that will execute the server on tokio's default executor.

Trait Implementations

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

Auto Trait Implementations

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>

impl<A, B> !RefUnwindSafe for Router<A, B>

Blanket Implementations

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

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

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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