pub struct IndexInfo {
pub idx_num: i32,
pub idx_str: Option<String>,
pub order_by_consumed: bool,
pub estimated_cost: f64,
pub estimated_rows: u32,
pub constraint_usages: Vec<ConstraintUsage>,
}Expand description
The internal (core) representation of an ‘index’ on a virtual table. Returned from xBestIndex and then processed and passed to VFilter.
Fields§
§idx_num: i32The index number, used to identify the index internally by the VTab
idx_str: Option<String>Optional index name. these are passed to vfilter in a tuple (idx_num, idx_str)
order_by_consumed: boolWhether the index is used for order by
estimated_cost: f64TODO: for eventual cost based query planning
estimated_rows: u32Estimated number of rows that the query will return
constraint_usages: Vec<ConstraintUsage>List of constraints that can be used to optimize the query.
Implementations§
Source§impl IndexInfo
impl IndexInfo
Sourcepub fn to_ffi(self) -> ExtIndexInfo
pub fn to_ffi(self) -> ExtIndexInfo
Converts IndexInfo to an FFI-safe ExtIndexInfo.
This method transfers ownership of constraint_usages and idx_str,
which must later be reclaimed using from_ffi to prevent leaks.
Sourcepub unsafe fn from_ffi(ffi: ExtIndexInfo) -> Self
pub unsafe fn from_ffi(ffi: ExtIndexInfo) -> Self
Reclaims ownership of constraint_usages and idx_str from an FFI-safe ExtIndexInfo.
§Safety
This method is unsafe because it can cause memory leaks if not used correctly. to_ffi and from_ffi are meant to send index info across ffi bounds then immediately reclaim it.