Expand description
Zero-copy row decoding for fixed-size types.
This module provides traits and types for zero-copy decoding of database rows where all fields have fixed wire sizes. This is useful for high-performance scenarios where avoiding allocations is critical.
§Requirements
- All struct fields must implement
FixedWireSize - All columns must be
NOT NULL(noOption<T>support) - Struct must use
#[repr(C, packed)]for predictable layout - Fields must use endian-aware types (e.g.,
I64LEinstead ofi64)
§Example
ⓘ
use zerocopy::little_endian::{I64 as I64LE, I32 as I32LE};
use zero_mysql::ref_row::RefFromRow;
#[derive(RefFromRow)]
#[repr(C, packed)]
struct UserStats {
user_id: I64LE,
login_count: I32LE,
}Traits§
- Fixed
Wire Size - Marker trait for types with a fixed wire size in MySQL binary protocol.
- RefFrom
Row - Trait for zero-copy decoding of a row into a fixed-size struct.
Type Aliases§
- I16LE
- A 16-bit signed integer stored in little-endian byte order.
- I32LE
- A 32-bit signed integer stored in little-endian byte order.
- I64LE
- A 64-bit signed integer stored in little-endian byte order.
- U16LE
- A 16-bit unsigned integer stored in little-endian byte order.
- U32LE
- A 32-bit unsigned integer stored in little-endian byte order.
- U64LE
- A 64-bit unsigned integer stored in little-endian byte order.