pub struct ChioTransport<R: Read, W: Write> { /* private fields */ }Expand description
Length-prefixed canonical JSON transport.
Reads AgentMessage frames from the reader and writes KernelMessage
frames to the writer. Each frame is a 4-byte big-endian length prefix
followed by that many bytes of canonical JSON.
Implementations§
Source§impl<R: Read, W: Write> ChioTransport<R, W>
impl<R: Read, W: Write> ChioTransport<R, W>
pub fn new(reader: R, writer: W) -> Self
Sourcepub fn recv(&mut self) -> Result<AgentMessage, TransportError>
pub fn recv(&mut self) -> Result<AgentMessage, TransportError>
Read one AgentMessage from the transport.
Blocks until a complete frame is available. Returns
TransportError::ConnectionClosed if the reader reaches EOF before
a complete frame is read.
Sourcepub fn send(&mut self, msg: &KernelMessage) -> Result<(), TransportError>
pub fn send(&mut self, msg: &KernelMessage) -> Result<(), TransportError>
Send one KernelMessage over the transport.
The message is serialized to canonical JSON (RFC 8785) and written as a length-prefixed frame. The writer is flushed after each send.
Auto Trait Implementations§
impl<R, W> Freeze for ChioTransport<R, W>
impl<R, W> RefUnwindSafe for ChioTransport<R, W>where
R: RefUnwindSafe,
W: RefUnwindSafe,
impl<R, W> Send for ChioTransport<R, W>
impl<R, W> Sync for ChioTransport<R, W>
impl<R, W> Unpin for ChioTransport<R, W>
impl<R, W> UnsafeUnpin for ChioTransport<R, W>where
R: UnsafeUnpin,
W: UnsafeUnpin,
impl<R, W> UnwindSafe for ChioTransport<R, W>where
R: UnwindSafe,
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