pub struct ChunkReader<R> { /* private fields */ }Expand description
Reads Bolt-chunked messages from an AsyncRead stream.
Each message consists of one or more chunks (2-byte big-endian length prefix followed by that many data bytes), terminated by a zero-length chunk (0x0000).
Implementations§
Source§impl<R: AsyncRead + Unpin> ChunkReader<R>
impl<R: AsyncRead + Unpin> ChunkReader<R>
pub fn new(reader: R) -> Self
Sourcepub fn set_max_message_size(&mut self, max_bytes: usize)
pub fn set_max_message_size(&mut self, max_bytes: usize)
Sets the maximum allowed message size in bytes.
Messages exceeding this limit will return a protocol error. Default: 16 MiB.
Sourcepub async fn read_message(&mut self) -> Result<BytesMut, BoltError>
pub async fn read_message(&mut self) -> Result<BytesMut, BoltError>
Reads a complete message (all chunks until the 0x0000 terminator).
Auto Trait Implementations§
impl<R> Freeze for ChunkReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for ChunkReader<R>where
R: RefUnwindSafe,
impl<R> Send for ChunkReader<R>where
R: Send,
impl<R> Sync for ChunkReader<R>where
R: Sync,
impl<R> Unpin for ChunkReader<R>where
R: Unpin,
impl<R> UnsafeUnpin for ChunkReader<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for ChunkReader<R>where
R: 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