Struct tower_lsp::LspService
source · [−]pub struct LspService<S> { /* private fields */ }
Expand description
Service abstraction for the Language Server Protocol.
This service takes an incoming JSON-RPC message as input and produces an outgoing message as
output. If the incoming message is a server notification or a client response, then the
corresponding response will be None
.
This implements tower::Service
in order to remain independent from the underlying transport
and to facilitate further abstraction with middleware.
Pending requests can be canceled by issuing a $/cancelRequest
notification.
The service shuts down and stops serving requests after the exit
notification is received.
Implementations
sourceimpl<S: LanguageServer> LspService<S>
impl<S: LanguageServer> LspService<S>
sourcepub fn new<F>(init: F) -> (Self, ClientSocket)where
F: FnOnce(Client) -> S,
pub fn new<F>(init: F) -> (Self, ClientSocket)where
F: FnOnce(Client) -> S,
Creates a new LspService
with the given server backend, also returning a channel for
server-to-client communication.
sourcepub fn build<F>(init: F) -> LspServiceBuilder<S>where
F: FnOnce(Client) -> S,
pub fn build<F>(init: F) -> LspServiceBuilder<S>where
F: FnOnce(Client) -> S,
Starts building a new LspService
.
Returns an LspServiceBuilder
, which allows adding custom JSON-RPC methods to the server.
Trait Implementations
sourceimpl<S: Debug> Debug for LspService<S>
impl<S: Debug> Debug for LspService<S>
sourceimpl<S: LanguageServer> Service<Request> for LspService<S>
impl<S: LanguageServer> Service<Request> for LspService<S>
type Error = ExitedError
type Error = ExitedError
type Future = Pin<Box<dyn Future<Output = Result<<LspService<S> as Service<Request>>::Response, <LspService<S> as Service<Request>>::Error>> + Send + 'static, Global>>
type Future = Pin<Box<dyn Future<Output = Result<<LspService<S> as Service<Request>>::Response, <LspService<S> as Service<Request>>::Error>> + Send + 'static, Global>>
Auto Trait Implementations
impl<S> !RefUnwindSafe for LspService<S>
impl<S> Send for LspService<S>where
S: Send + Sync,
impl<S> !Sync for LspService<S>
impl<S> Unpin for LspService<S>
impl<S> !UnwindSafe for LspService<S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
sourcefn ready(&mut self) -> Ready<'_, Self, Request>
fn ready(&mut self) -> Ready<'_, Self, Request>
sourcefn ready_and(&mut self) -> Ready<'_, Self, Request>
fn ready_and(&mut self) -> Ready<'_, Self, Request>
please use the ServiceExt::ready
method instead
sourcefn ready_oneshot(self) -> ReadyOneshot<Self, Request>
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>
sourcefn oneshot(self, req: Request) -> Oneshot<Self, Request>
fn oneshot(self, req: Request) -> Oneshot<Self, Request>
Service
, calling with the providing request once it is ready.sourcefn call_all<S>(self, reqs: S) -> CallAll<Self, S>where
S: Stream<Item = Request>,
Self::Error: Into<Box<dyn Error + Send + Sync + 'static, Global>>,
fn call_all<S>(self, reqs: S) -> CallAll<Self, S>where
S: Stream<Item = Request>,
Self::Error: Into<Box<dyn Error + Send + Sync + 'static, Global>>,
sourcefn and_then<F>(self, f: F) -> AndThen<Self, F>where
F: Clone,
fn and_then<F>(self, f: F) -> AndThen<Self, F>where
F: Clone,
poll_ready
method. Read moresourcefn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where
F: FnOnce(Self::Response) -> Response + Clone,
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where
F: FnOnce(Self::Response) -> Response + Clone,
poll_ready
method. Read moresourcefn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where
F: FnOnce(Self::Error) -> Error + Clone,
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where
F: FnOnce(Self::Error) -> Error + Clone,
poll_ready
method. Read moresourcefn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,
Result<Self::Response, Self::Error>
)
to a different value, regardless of whether the future succeeds or
fails. Read more