#[non_exhaustive]pub struct TableIndex {
pub column: Vec<u8>,
pub kind: IndexKind,
pub values: Vec<Vec<u8>>,
}Expand description
One declared secondary index: a column and a scalar kind, plus the
stored VALUES columns residual FILTER/SORT read.
use kevy_index::{IndexKind, TableIndex};
let mut ix = TableIndex::new("at", IndexKind::Range);
ix.values.push(b"city".to_vec());
assert_eq!((ix.column.as_slice(), ix.values.len()), (&b"at"[..], 1));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.column: Vec<u8>Declared column the index reads.
let t = declare("TABLE.DECLARE t PREFIX t: PK id COLUMN id i64 COLUMN at i64 INDEX at range")?;
assert_eq!(t.indexes[0].column, b"at");
assert_eq!(t.compile()?[0].name(), b"t.at", "the column names the compiled index");kind: IndexKindRange or Unique — nothing else compiles from a table
(aggregates stay a direct IDX.CREATE KIND agg declaration).
let t = declare("TABLE.DECLARE t PREFIX t: PK id COLUMN id i64 INDEX id unique")?;
assert_eq!(t.indexes[0].kind, IndexKind::Unique);values: Vec<Vec<u8>>Declared columns stored per row (typed from the column decls).
let t = declare("TABLE.DECLARE t PREFIX t: PK id COLUMN id i64 COLUMN city str INDEX id range VALUES city")?;
assert_eq!(t.indexes[0].values, [b"city".to_vec()]);
assert_eq!(t.compile()?[0].values().len(), 1, "stored alongside each entry");Implementations§
Source§impl TableIndex
impl TableIndex
Trait Implementations§
Source§impl Clone for TableIndex
impl Clone for TableIndex
Source§fn clone(&self) -> TableIndex
fn clone(&self) -> TableIndex
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TableIndex
impl Debug for TableIndex
impl Eq for TableIndex
Source§impl Hash for TableIndex
impl Hash for TableIndex
Source§impl PartialEq for TableIndex
impl PartialEq for TableIndex
impl StructuralPartialEq for TableIndex
Auto Trait Implementations§
impl Freeze for TableIndex
impl RefUnwindSafe for TableIndex
impl Send for TableIndex
impl Sync for TableIndex
impl Unpin for TableIndex
impl UnsafeUnpin for TableIndex
impl UnwindSafe for TableIndex
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