pub struct Router<S> { /* private fields */ }Implementations§
source§impl<S> Router<S>
impl<S> Router<S>
pub fn new(state: S) -> Self
pub fn request<R: Request, Fut>( &mut self, handler: impl Fn(&mut S, R::Params) -> Fut + Send + 'static ) -> &mut Selfwhere Fut: Future<Output = Result<R::Result, ResponseError>> + Send + 'static,
pub fn notification<N: Notification>( &mut self, handler: impl Fn(&mut S, N::Params) -> ControlFlow<Result<()>> + Send + 'static ) -> &mut Self
pub fn event<E: Send + 'static>( &mut self, handler: impl Fn(&mut S, E) -> ControlFlow<Result<()>> + Send + 'static ) -> &mut Self
pub fn unhandled_request<Fut>( &mut self, handler: impl Fn(&mut S, AnyRequest) -> Fut + Send + 'static ) -> &mut Selfwhere Fut: Future<Output = Result<JsonValue, ResponseError>> + Send + 'static,
pub fn unhandled_notification( &mut self, handler: impl Fn(&mut S, AnyNotification) -> ControlFlow<Result<()>> + Send + 'static ) -> &mut Self
pub fn unhandled_event( &mut self, handler: impl Fn(&mut S, AnyEvent) -> ControlFlow<Result<()>> + Send + 'static ) -> &mut Self
source§impl<S> Router<S>where
S: LanguageServer<NotifyResult = ControlFlow<Result<()>>>,
ResponseError: From<S::Error>,
impl<S> Router<S>where S: LanguageServer<NotifyResult = ControlFlow<Result<()>>>, ResponseError: From<S::Error>,
pub fn from_language_server(state: S) -> Self
source§impl<S> Router<S>where
S: LanguageClient<NotifyResult = ControlFlow<Result<()>>>,
ResponseError: From<S::Error>,
impl<S> Router<S>where S: LanguageClient<NotifyResult = ControlFlow<Result<()>>>, ResponseError: From<S::Error>,
pub fn from_language_client(state: S) -> Self
Trait Implementations§
source§impl<S> LspService for Router<S>
impl<S> LspService for Router<S>
fn notify(&mut self, notif: AnyNotification) -> ControlFlow<Result<()>>
fn emit(&mut self, event: AnyEvent) -> ControlFlow<Result<()>>
source§impl<S> Service<AnyRequest> for Router<S>
impl<S> Service<AnyRequest> for Router<S>
§type Error = ResponseError
type Error = ResponseError
Errors produced by the service.
§type Future = Pin<Box<dyn Future<Output = Result<Value, ResponseError>> + Send + 'static, Global>>
type Future = Pin<Box<dyn Future<Output = Result<Value, ResponseError>> + Send + 'static, Global>>
The future response value.