#[non_exhaustive]pub enum Key {
Undefined,
Bool(bool),
Integer(i64),
String(String),
}Expand description
A map key: one of the four kinds the reference’s instruction-set text
lets index a map, a string, an integer, a boolean or undefined. (null
is not one of the four; a lookup by null is a miss, not an error.)
Keys are totally ordered: undefined first, then false and true, then
integers in numeric order, then strings in codepoint order. A map keeps
its keys in this order.
use predicator_rs::Key;
let mut keys = vec![Key::from("a"), Key::from(2), Key::from(true), Key::Undefined];
keys.sort();
assert_eq!(keys, [Key::Undefined, Key::from(true), Key::from(2), Key::from("a")]);
assert_eq!(format!("{:?}", keys), r#"[Undefined, true, 2, "a"]"#);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.
Undefined
The undefined key.
Bool(bool)
false or true.
Integer(i64)
An integer.
String(String)
A string.
Trait Implementations§
impl Eq for Key
Source§impl Ord for Key
impl Ord for Key
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Key
impl PartialOrd for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl Forget for Key
impl Freeze for Key
impl Move for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnsafeUnpin for Key
impl UnwindSafe for Key
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