pub struct WireFormat;Expand description
Wire format utilities for ClickHouse protocol
Implementations§
Source§impl WireFormat
impl WireFormat
Sourcepub async fn read_varint64<R: AsyncRead + Unpin>(reader: &mut R) -> Result<u64>
pub async fn read_varint64<R: AsyncRead + Unpin>(reader: &mut R) -> Result<u64>
Read a varint-encoded u64
Sourcepub async fn write_varint64<W: AsyncWrite + Unpin>(
writer: &mut W,
value: u64,
) -> Result<()>
pub async fn write_varint64<W: AsyncWrite + Unpin>( writer: &mut W, value: u64, ) -> Result<()>
Write a varint-encoded u64
Sourcepub async fn read_fixed<R: AsyncRead + Unpin + Send, T: FixedSize>(
reader: &mut R,
) -> Result<T>
pub async fn read_fixed<R: AsyncRead + Unpin + Send, T: FixedSize>( reader: &mut R, ) -> Result<T>
Read a fixed-size value (little-endian)
Sourcepub async fn write_fixed<W: AsyncWrite + Unpin + Send, T: FixedSize>(
writer: &mut W,
value: T,
) -> Result<()>
pub async fn write_fixed<W: AsyncWrite + Unpin + Send, T: FixedSize>( writer: &mut W, value: T, ) -> Result<()>
Write a fixed-size value (little-endian)
Sourcepub async fn read_string<R: AsyncRead + Unpin>(reader: &mut R) -> Result<String>
pub async fn read_string<R: AsyncRead + Unpin>(reader: &mut R) -> Result<String>
Read a length-prefixed string
Sourcepub async fn write_string<W: AsyncWrite + Unpin>(
writer: &mut W,
value: &str,
) -> Result<()>
pub async fn write_string<W: AsyncWrite + Unpin>( writer: &mut W, value: &str, ) -> Result<()>
Write a length-prefixed string
Sourcepub async fn read_bytes<R: AsyncRead + Unpin>(
reader: &mut R,
len: usize,
) -> Result<Vec<u8>>
pub async fn read_bytes<R: AsyncRead + Unpin>( reader: &mut R, len: usize, ) -> Result<Vec<u8>>
Read raw bytes of specified length
Sourcepub async fn write_bytes<W: AsyncWrite + Unpin>(
writer: &mut W,
bytes: &[u8],
) -> Result<()>
pub async fn write_bytes<W: AsyncWrite + Unpin>( writer: &mut W, bytes: &[u8], ) -> Result<()>
Write raw bytes
Sourcepub async fn skip_string<R: AsyncRead + Unpin>(reader: &mut R) -> Result<()>
pub async fn skip_string<R: AsyncRead + Unpin>(reader: &mut R) -> Result<()>
Skip a string without reading it into memory
Sourcepub async fn write_quoted_string<W: AsyncWrite + Unpin>(
writer: &mut W,
value: &str,
) -> Result<()>
pub async fn write_quoted_string<W: AsyncWrite + Unpin>( writer: &mut W, value: &str, ) -> Result<()>
Write a quoted string for query parameters (1:1 port of C++ WriteQuotedString)
Format: varint(length) + quoted_string Special chars escaped: \0, \b, \t, \n, ’, \
Escaping rules:
- \0 → \x00
- \b → \x08
- \t → \t
- \n → \n
- ’ → \x27
- \ → \\
Auto Trait Implementations§
impl Freeze for WireFormat
impl RefUnwindSafe for WireFormat
impl Send for WireFormat
impl Sync for WireFormat
impl Unpin for WireFormat
impl UnwindSafe for WireFormat
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