#[non_exhaustive]pub struct OrderPath {
pub name: Vec<u8>,
pub on: Vec<(Vec<u8>, SortOrder)>,
}Expand description
One composite-sort path (ORDERPATH — cookbook §8 mechanized):
compiles to a composite Range index named <table>.<name>.
use kevy_index::{OrderPath, SortOrder};
let p = OrderPath::new("recent", vec![(b"at".to_vec(), SortOrder::Desc)]);
assert_eq!(p.on[0].1, SortOrder::Desc);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.name: Vec<u8>Path name (the compiled index’s suffix).
let t = declare("TABLE.DECLARE t PREFIX t: PK id COLUMN id i64 ORDERPATH newest ON id DESC")?;
assert_eq!(t.orderpaths[0].name, b"newest");
assert_eq!(t.compile()?[0].name(), b"t.newest");on: Vec<(Vec<u8>, SortOrder)>(column, direction) in sort-significance order.
let t = declare("TABLE.DECLARE t PREFIX t: PK id COLUMN id i64 COLUMN c str ORDERPATH p ON c THEN id DESC")?;
assert_eq!(t.orderpaths[0].on, [(b"c".to_vec(), SortOrder::Asc), (b"id".to_vec(), SortOrder::Desc)]);Implementations§
Trait Implementations§
impl Eq for OrderPath
impl StructuralPartialEq for OrderPath
Auto Trait Implementations§
impl Freeze for OrderPath
impl RefUnwindSafe for OrderPath
impl Send for OrderPath
impl Sync for OrderPath
impl Unpin for OrderPath
impl UnsafeUnpin for OrderPath
impl UnwindSafe for OrderPath
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