pub struct Codec { /* private fields */ }Expand description
Compression callbacks used by clickhouse-c.
Value is pinned because C code retains address of callback table.
Implementations§
Source§impl Codec
impl Codec
Sourcepub fn empty() -> Pin<Box<Self>>
pub fn empty() -> Pin<Box<Self>>
Creates a codec without compression callbacks.
Codec only supports Compression::None until required callbacks are
installed through raw_mut. Client::init
rejects missing callbacks.
Sourcepub unsafe fn from_raw(raw: chc_codec) -> Pin<Box<Self>>
pub unsafe fn from_raw(raw: chc_codec) -> Pin<Box<Self>>
Creates a codec from a raw callback table.
§Safety
Each function pointer must match corresponding field signature. All
callbacks required by selected Compression must be present. User
data referenced by ud must remain valid while codec exists and from
every thread that uses codec.
Sourcepub unsafe fn raw_mut(self: Pin<&mut Self>) -> &mut chc_codec
pub unsafe fn raw_mut(self: Pin<&mut Self>) -> &mut chc_codec
Returns mutable access to raw callback table.
§Safety
C library calls installed function pointers without validation.
- Each function pointer must match corresponding field signature.
- All callbacks required by selected
Compressionmust be present. For example, LZ4 requireslz4_compress,lz4_decompress, andlz4_bound. - Data referenced by
udmust remain valid while codec exists and from every thread that uses codec.
Trait Implementations§
Auto Trait Implementations§
impl !Sync for Codec
impl !Unpin for Codec
impl !UnsafeUnpin for Codec
impl Freeze for Codec
impl RefUnwindSafe for Codec
impl UnwindSafe for Codec
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