pub struct Router<S> {
pub tool_router: ToolRouter<S>,
pub service: Arc<S>,
}Available on crate feature
server only.Fields§
§tool_router: ToolRouter<S>§service: Arc<S>Implementations§
Source§impl<S> Router<S>where
S: ServerHandler,
impl<S> Router<S>where
S: ServerHandler,
pub fn new(service: S) -> Self
pub fn with_tool<R, A>(self, route: R) -> Selfwhere
R: IntoToolRoute<S, A>,
pub fn with_tools(self, routes: impl IntoIterator<Item = ToolRoute<S>>) -> Self
Trait Implementations§
Source§impl<S> Service<RoleServer> for Router<S>where
S: ServerHandler,
impl<S> Service<RoleServer> for Router<S>where
S: ServerHandler,
Source§async fn handle_notification(
&self,
notification: <RoleServer as ServiceRole>::PeerNot,
context: NotificationContext<RoleServer>,
) -> Result<(), Error>
async fn handle_notification( &self, notification: <RoleServer as ServiceRole>::PeerNot, context: NotificationContext<RoleServer>, ) -> Result<(), Error>
Available on crate features
client or server only.Source§async fn handle_request(
&self,
request: <RoleServer as ServiceRole>::PeerReq,
context: RequestContext<RoleServer>,
) -> Result<<RoleServer as ServiceRole>::Resp, Error>
async fn handle_request( &self, request: <RoleServer as ServiceRole>::PeerReq, context: RequestContext<RoleServer>, ) -> Result<<RoleServer as ServiceRole>::Resp, Error>
Available on crate features
client or server only.Source§fn get_info(&self) -> <RoleServer as ServiceRole>::Info
fn get_info(&self) -> <RoleServer as ServiceRole>::Info
Available on crate features
client or server only.Auto Trait Implementations§
impl<S> Freeze for Router<S>
impl<S> !RefUnwindSafe for Router<S>
impl<S> Send for Router<S>
impl<S> Sync for Router<S>
impl<S> Unpin for Router<S>
impl<S> UnsafeUnpin for Router<S>
impl<S> !UnwindSafe for Router<S>
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<R, S> DynService<R> for Swhere
R: ServiceRole,
S: Service<R>,
impl<R, S> DynService<R> for Swhere
R: ServiceRole,
S: Service<R>,
Source§fn handle_request(
&self,
request: <R as ServiceRole>::PeerReq,
context: RequestContext<R>,
) -> Pin<Box<dyn Future<Output = Result<<R as ServiceRole>::Resp, ErrorData>> + Send + '_>>
fn handle_request( &self, request: <R as ServiceRole>::PeerReq, context: RequestContext<R>, ) -> Pin<Box<dyn Future<Output = Result<<R as ServiceRole>::Resp, ErrorData>> + Send + '_>>
Available on crate features
client or server only.Source§fn handle_notification(
&self,
notification: <R as ServiceRole>::PeerNot,
context: NotificationContext<R>,
) -> Pin<Box<dyn Future<Output = Result<(), ErrorData>> + Send + '_>>
fn handle_notification( &self, notification: <R as ServiceRole>::PeerNot, context: NotificationContext<R>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorData>> + Send + '_>>
Available on crate features
client or server only.Source§fn get_info(&self) -> <R as ServiceRole>::Info
fn get_info(&self) -> <R as ServiceRole>::Info
Available on crate features
client or server only.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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<S> ServiceExt<RoleServer> for Swhere
S: Service<RoleServer>,
impl<S> ServiceExt<RoleServer> for Swhere
S: Service<RoleServer>,
Source§fn serve_with_ct<T, E, A>(
self,
transport: T,
ct: CancellationToken,
) -> impl Future<Output = Result<RunningService<RoleServer, S>, ServerInitializeError<E>>> + Send
fn serve_with_ct<T, E, A>( self, transport: T, ct: CancellationToken, ) -> impl Future<Output = Result<RunningService<RoleServer, S>, ServerInitializeError<E>>> + Send
Available on crate features
client or server only.Source§fn into_dyn(self) -> Box<dyn DynService<R>>
fn into_dyn(self) -> Box<dyn DynService<R>>
Available on crate features
client or server only.Convert this service to a dynamic boxed service Read more
Source§fn serve<T, E, A>(
self,
transport: T,
) -> impl Future<Output = Result<RunningService<R, Self>, R::InitializeError<E>>> + Send
fn serve<T, E, A>( self, transport: T, ) -> impl Future<Output = Result<RunningService<R, Self>, R::InitializeError<E>>> + Send
Available on crate features
client or server only.