pub struct LspWriter<W> { /* private fields */ }Expand description
One-message-at-a-time async writer.
Wraps any AsyncWrite. The actor wraps stdin of the child
process; tests wrap a Vec<u8> or duplex pipe.
Implementations§
Source§impl<W: AsyncWrite + Unpin> LspWriter<W>
impl<W: AsyncWrite + Unpin> LspWriter<W>
pub fn new(inner: W) -> Self
Sourcepub async fn write_message(&mut self, msg: &Message) -> Result<(), CodecError>
pub async fn write_message(&mut self, msg: &Message) -> Result<(), CodecError>
Encode msg as JSON, prepend the framing header, write
header + body, and flush. One flush per message keeps
latency bounded – LSP servers expect timely delivery of
didChange etc.
Auto Trait Implementations§
impl<W> Freeze for LspWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for LspWriter<W>where
W: RefUnwindSafe,
impl<W> Send for LspWriter<W>where
W: Send,
impl<W> Sync for LspWriter<W>where
W: Sync,
impl<W> Unpin for LspWriter<W>where
W: Unpin,
impl<W> UnsafeUnpin for LspWriter<W>where
W: UnsafeUnpin,
impl<W> UnwindSafe for LspWriter<W>where
W: UnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more