pub struct MainLoop<S: LspService> { /* private fields */ }
Expand description
Service main loop driver for either Language Servers or Language Clients.
Implementations§
source§impl<S: LspService> MainLoop<S>
impl<S: LspService> MainLoop<S>
source§impl<S> MainLoop<S>where
S: LspService<Response = Value>,
ResponseError: From<S::Error>,
impl<S> MainLoop<S>where S: LspService<Response = Value>, ResponseError: From<S::Error>,
sourcepub fn new_server(
builder: impl FnOnce(ClientSocket) -> S
) -> (Self, ClientSocket)
pub fn new_server( builder: impl FnOnce(ClientSocket) -> S ) -> (Self, ClientSocket)
Create a Language Server main loop.
sourcepub fn new_client(
builder: impl FnOnce(ServerSocket) -> S
) -> (Self, ServerSocket)
pub fn new_client( builder: impl FnOnce(ServerSocket) -> S ) -> (Self, ServerSocket)
Create a Language Client main loop.
sourcepub async fn run_buffered(
self,
input: impl AsyncRead,
output: impl AsyncWrite
) -> Result<()>
pub async fn run_buffered( self, input: impl AsyncRead, output: impl AsyncWrite ) -> Result<()>
Drive the service main loop to provide the service.
Shortcut to MainLoop::run
that accept an impl AsyncRead
and implicit wrap it in a
[BufReader
].
sourcepub async fn run(
self,
input: impl AsyncBufRead,
output: impl AsyncWrite
) -> Result<()>
pub async fn run( self, input: impl AsyncBufRead, output: impl AsyncWrite ) -> Result<()>
Drive the service main loop to provide the service.
Errors
Error::Io
when the underlyinginput
oroutput
raises an error.Error::Deserialize
when the peer sends undecodable or invalid message.Error::Protocol
when the peer violates Language Server Protocol.- Other errors raised from service handlers.
Auto Trait Implementations§
impl<S> !RefUnwindSafe for MainLoop<S>
impl<S> Send for MainLoop<S>where S: Send, <S as Service<AnyRequest>>::Future: Send,
impl<S> Sync for MainLoop<S>where S: Sync, <S as Service<AnyRequest>>::Future: Sync,
impl<S> Unpin for MainLoop<S>where S: Unpin,
impl<S> !UnwindSafe for MainLoop<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