Trait RowReadable
pub trait RowReadable:
Sized
+ Send
+ TableRow {
// Required method
fn row_read(
data: &[u8],
offset: &mut usize,
rid: u32,
sizes: &TableInfoRef,
) -> Result<Self>;
}Expand description
Trait defining the interface for reading and parsing metadata table rows.
This trait must be implemented by any type that represents a row in a metadata table. It provides the necessary methods for parsing row data from byte buffers, enabling generic table operations.
§Implementation Requirements
Types implementing this trait must:
- Be
Sendto support parallel processing - Handle parsing errors gracefully
- Support 1-based row indexing (as per CLI specification)
Required Methods§
fn row_read(
data: &[u8],
offset: &mut usize,
rid: u32,
sizes: &TableInfoRef,
) -> Result<Self>
fn row_read( data: &[u8], offset: &mut usize, rid: u32, sizes: &TableInfoRef, ) -> Result<Self>
Reads and parses a single row from the provided byte buffer.
This method extracts and parses one complete row from the metadata table data, advancing the offset pointer to the next row position. The row ID follows the CLI specification’s 1-based indexing scheme.
§Arguments
data- The byte buffer containing the table data to read fromoffset- Mutable reference to the current read position, automatically advanced by the number of bytes consumedrid- The 1-based row identifier for this entry (starts at 1, not 0)sizes- Table size information for parsing variable-sized fields
§Returns
Returns a Result containing the parsed row instance on success.
§Errors
Returns crate::Error in the following cases:
crate::Error- When the buffer contains insufficient data or malformed row structurecrate::Error- When heap indices reference invalid locationscrate::Error- When row identifiers are out of valid range
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.