pub struct Delimited<U>(/* private fields */);
Expand description
Transport stream with JSON frames delimited by null characters.
Implementations§
source§impl<U: AsyncRead + AsyncWrite + Unpin> Delimited<U>
impl<U: AsyncRead + AsyncWrite + Unpin> Delimited<U>
sourcepub async fn recv<T: DeserializeOwned>(&mut self) -> Result<Option<T>>
pub async fn recv<T: DeserializeOwned>(&mut self) -> Result<Option<T>>
Read the next null-delimited JSON instruction from a stream.
sourcepub async fn recv_timeout<T: DeserializeOwned>(&mut self) -> Result<Option<T>>
pub async fn recv_timeout<T: DeserializeOwned>(&mut self) -> Result<Option<T>>
Read the next null-delimited JSON instruction, with a default timeout.
This is useful for parsing the initial message of a stream for handshake or other protocol purposes, where we do not want to wait indefinitely.
sourcepub async fn send<T: Serialize>(&mut self, msg: T) -> Result<()>
pub async fn send<T: Serialize>(&mut self, msg: T) -> Result<()>
Send a null-terminated JSON instruction on a stream.
sourcepub fn into_parts(self) -> FramedParts<U, AnyDelimiterCodec>
pub fn into_parts(self) -> FramedParts<U, AnyDelimiterCodec>
Consume this object, returning current buffers and the inner transport.
Auto Trait Implementations§
impl<U> Freeze for Delimited<U>where
U: Freeze,
impl<U> RefUnwindSafe for Delimited<U>where
U: RefUnwindSafe,
impl<U> Send for Delimited<U>where
U: Send,
impl<U> Sync for Delimited<U>where
U: Sync,
impl<U> Unpin for Delimited<U>where
U: Unpin,
impl<U> UnwindSafe for Delimited<U>where
U: 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