pub struct Router<St> { /* private fields */ }
Implementations§
source§impl<St> Router<St>
impl<St> Router<St>
pub fn new(state: St) -> Self
pub fn request<R: Request, Fut>( &mut self, handler: impl Fn(&mut St, 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 St, N::Params) -> ControlFlow<Result<()>> + Send + 'static ) -> &mut Self
pub fn event<E: Send + 'static>( &mut self, handler: impl Fn(&mut St, E) -> ControlFlow<Result<()>> + Send + 'static ) -> &mut Self
pub fn unhandled_request<Fut>( &mut self, handler: impl Fn(&mut St, AnyRequest) -> Fut + Send + 'static ) -> &mut Selfwhere Fut: Future<Output = Result<JsonValue, ResponseError>> + Send + 'static,
pub fn unhandled_notification( &mut self, handler: impl Fn(&mut St, AnyNotification) -> ControlFlow<Result<()>> + Send + 'static ) -> &mut Self
pub fn unhandled_event( &mut self, handler: impl Fn(&mut St, 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<St> LspService for Router<St>
impl<St> LspService for Router<St>
fn notify(&mut self, notif: AnyNotification) -> ControlFlow<Result<()>>
fn emit(&mut self, event: AnyEvent) -> ControlFlow<Result<()>>
source§impl<St> Service<AnyRequest> for Router<St>
impl<St> Service<AnyRequest> for Router<St>
§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.
Auto Trait Implementations§
impl<St> !RefUnwindSafe for Router<St>
impl<St> Send for Router<St>where St: Send,
impl<St> !Sync for Router<St>
impl<St> Unpin for Router<St>where St: Unpin,
impl<St> !UnwindSafe for Router<St>
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