Skip to main content

HurrayKvValue

Struct HurrayKvValue 

Source
#[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: u8

Which HURRAY_KV_* kind this value is.

§bool_value: bool

Set when kind is HURRAY_KV_BOOL.

§i64_value: i64

Set when kind is HURRAY_KV_INT64.

§u64_value: u64

Set when kind is HURRAY_KV_UINT64.

§f64_value: f64

Set when kind is HURRAY_KV_FLOAT64.

§data: *const u8

First byte of a HURRAY_KV_STRING or HURRAY_KV_BYTES payload, else null.

§data_len: usize

Byte length of data. A string is UTF-8 and carries no NUL terminator.

§items: *const HurrayKvValue

First element of a HURRAY_KV_ARRAY, else null.

§item_count: usize

Number of elements at items.

Trait Implementations§

Source§

impl Clone for HurrayKvValue

Source§

fn clone(&self) -> HurrayKvValue

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for HurrayKvValue

Source§

impl Default for HurrayKvValue

Source§

fn default() -> Self

A zeroed value with a null kind, which is what a C caller gets from {0}.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.