pub struct Router<A, B> { /* private fields */ }
Expand description
A Router
is used to compile Routes
, by adding services.
Implementations§
Source§impl<A, B> Router<A, B>
impl<A, B> Router<A, B>
Sourcepub fn add_service<C>(self, service: C) -> Router<C, Route<A, B>>
pub fn add_service<C>(self, service: C) -> Router<C, Route<A, B>>
Sourcepub 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,
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,
Trait Implementations§
Auto Trait Implementations§
impl<A, B> Freeze for Router<A, B>
impl<A, B> RefUnwindSafe for Router<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Router<A, B>
impl<A, B> Sync for Router<A, B>
impl<A, B> Unpin for Router<A, B>
impl<A, B> UnwindSafe for Router<A, B>where
A: UnwindSafe,
B: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request