pub enum EntryMetaValue {
Null,
Bool(bool),
Int(i64),
Float(f64),
String(Arc<str>),
Bytes(Arc<[u8]>),
Array(Arc<[Self]>),
Object(Arc<BTreeMap<Arc<str>, Self>>),
}Expand description
A no_std-compatible JSON-like value for VectorEntry metadata.
All heap-owning variants wrap their payload in Arc so that cloning
is O(1) (a reference-count bump), never O(n) (a deep copy).
§Equality
All variants use structural equality except Float, which uses
bit-exact comparison so that NaN == NaN (see module-level docs).
Variants§
Null
JSON null.
Bool(bool)
JSON true / false.
Int(i64)
JSON integer, stored as i64.
Float(f64)
JSON number with fractional part.
Equality is bit-exact (f64::to_bits), not IEEE 754.
NaN == NaN returns true here; see the module docs for rationale.
String(Arc<str>)
JSON string, reference-counted for O(1) clone.
Bytes(Arc<[u8]>)
Raw bytes (Python bytes values), reference-counted for O(1) clone.
Stored as a byte slice rather than base64-encoded string to preserve Python round-trip parity.
Array(Arc<[Self]>)
JSON array, reference-counted for O(1) clone.
Object(Arc<BTreeMap<Arc<str>, Self>>)
JSON object (key-ordered BTreeMap), reference-counted for O(1) clone.
Keys are Arc<str> for shared ownership; ordering is deterministic
(lexicographic), which helps with test fixtures. HashMap is not used
because it requires std’s default hasher.
Implementations§
Source§impl EntryMetaValue
impl EntryMetaValue
Sourcepub fn object(map: BTreeMap<Arc<str>, Self>) -> Self
pub fn object(map: BTreeMap<Arc<str>, Self>) -> Self
Construct an Object variant from a BTreeMap.
Sourcepub const fn as_bool(&self) -> Option<bool>
pub const fn as_bool(&self) -> Option<bool>
Returns the inner bool, or None if this is not a Bool variant.
Sourcepub const fn as_int(&self) -> Option<i64>
pub const fn as_int(&self) -> Option<i64>
Returns the inner i64, or None if this is not an Int variant.
Sourcepub const fn as_float(&self) -> Option<f64>
pub const fn as_float(&self) -> Option<f64>
Returns the inner f64, or None if this is not a Float variant.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Returns the inner Arc<str>, or None if this is not a String variant.
Sourcepub fn as_bytes(&self) -> Option<&[u8]>
pub fn as_bytes(&self) -> Option<&[u8]>
Returns the inner bytes, or None if this is not a Bytes variant.
Trait Implementations§
Source§impl Clone for EntryMetaValue
impl Clone for EntryMetaValue
Source§fn clone(&self) -> EntryMetaValue
fn clone(&self) -> EntryMetaValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EntryMetaValue
impl Debug for EntryMetaValue
Source§impl From<&str> for EntryMetaValue
impl From<&str> for EntryMetaValue
Source§impl From<String> for EntryMetaValue
impl From<String> for EntryMetaValue
Source§impl From<bool> for EntryMetaValue
impl From<bool> for EntryMetaValue
Source§impl From<f32> for EntryMetaValue
impl From<f32> for EntryMetaValue
Source§impl From<f64> for EntryMetaValue
impl From<f64> for EntryMetaValue
Source§impl From<i32> for EntryMetaValue
impl From<i32> for EntryMetaValue
Source§impl From<i64> for EntryMetaValue
impl From<i64> for EntryMetaValue
Source§impl PartialEq for EntryMetaValue
impl PartialEq for EntryMetaValue
impl Eq for EntryMetaValue
Eq is safe because float equality is bit-exact (NaN == NaN by bits).