#[non_exhaustive]pub enum ViewMode {
Virtual,
Materialized {
top_k: u32,
},
}Expand description
View mode.
use kevy_index::{IndexValue, Leaf, Tree, ViewMode, ViewSpec};
let t = Tree::Leaf(Leaf::new("age", IndexValue::I64(0), IndexValue::I64(99)));
let v = ViewSpec::new("v", t, "age");
assert_eq!(v.mode, ViewMode::Virtual, "views are virtual unless declared otherwise");Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Virtual
Evaluate the tree at query time.
use kevy_index::ViewMode;
assert_eq!(ViewMode::Virtual.name(), "virtual");Materialized
Maintain an incremental result set; top_k = 0 = unbounded.
use kevy_index::ViewMode;
let m = ViewMode::Materialized { top_k: 10 };
assert_eq!(m.name(), "materialized");Fields
§
top_k: u32Bounded size (0 = keep every member).
use kevy_index::{IndexValue, MaterializedSet, Membership, SortOrder};
// K = 2 keeps K + K/4 = 2 members
let mut top2 = MaterializedSet::new(2, SortOrder::Desc);
for (k, v) in [(b"a", 1), (b"b", 5), (b"c", 3)] {
top2.apply(k, Membership::Member(Some(IndexValue::I64(v))));
}
assert_eq!(top2.len(), 2, "top_k bounds the members kept");
assert_eq!(top2.page(None, 9)[1], (IndexValue::I64(3), b"c".to_vec()));Implementations§
Trait Implementations§
impl Copy for ViewMode
impl Eq for ViewMode
impl StructuralPartialEq for ViewMode
Auto Trait Implementations§
impl Freeze for ViewMode
impl RefUnwindSafe for ViewMode
impl Send for ViewMode
impl Sync for ViewMode
impl Unpin for ViewMode
impl UnsafeUnpin for ViewMode
impl UnwindSafe for ViewMode
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