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>
impl<S> MainLoop<S>
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> !Freeze for MainLoop<S>
impl<S> !RefUnwindSafe for MainLoop<S>
impl<S> Send for MainLoop<S>
impl<S> Sync for MainLoop<S>
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