#[repr(C)]pub struct HurrayKvValue {
pub kind: u8,
pub bool_value: bool,
pub i64_value: i64,
pub u64_value: u64,
pub f64_value: f64,
pub data: *const u8,
pub data_len: usize,
pub items: *const HurrayKvValue,
pub item_count: usize,
}Expand description
One typed KV value: a kind tag and the fields that tag selects.
A flat tagged struct rather than a union, because every binding generator downstream of this header reads a struct correctly and few read a union well. Fields the tag does not select are zero on a read and ignored on a write.
Arrays nest one level and no further — the format forbids an array of arrays — so an
items element is always a scalar.
Fields§
§kind: u8Which HURRAY_KV_* kind this value is.
bool_value: boolSet when kind is HURRAY_KV_BOOL.
i64_value: i64Set when kind is HURRAY_KV_INT64.
u64_value: u64Set when kind is HURRAY_KV_UINT64.
f64_value: f64Set when kind is HURRAY_KV_FLOAT64.
data: *const u8First byte of a HURRAY_KV_STRING or HURRAY_KV_BYTES payload, else null.
data_len: usizeByte length of data. A string is UTF-8 and carries no NUL terminator.
items: *const HurrayKvValueFirst element of a HURRAY_KV_ARRAY, else null.
item_count: usizeNumber of elements at items.
Trait Implementations§
Source§impl Clone for HurrayKvValue
impl Clone for HurrayKvValue
Source§fn clone(&self) -> HurrayKvValue
fn clone(&self) -> HurrayKvValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more