Value
A decoded Kiwi value. Messages and structs are Objects that keep the field
order of the data.
The as_* accessors return None when the value is of another type, so a chain of get
and as_* reads like a path.
Import
Section titled “Import”Cargo feature kiwi (enabled by default). To compile only this module:
or in Cargo.toml:
Definition
Section titled “Definition”Examples
Section titled “Examples”Methods
Section titled “Methods”A field of an object.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | &str | The field name. |
Returns
Option<&Self> — The field, or None when this is not an object or has no such field (a message omits its
absent fields).
as_str
Section titled “as_str”The text of a string or of an enum member name.
Returns
Option<&str> — The text, or None for any other value.
as_bool
Section titled “as_bool”The value of a bool.
Returns
Option<bool> — The boolean, or None for any other value.
as_i32
Section titled “as_i32”The value of an int.
Returns
Option<i32> — The integer, or None for any other value.
as_u32
Section titled “as_u32”The value of a uint.
Returns
Option<u32> — The integer, or None for any other value.
as_i64
Section titled “as_i64”The value of an int64.
Returns
Option<i64> — The integer, or None for any other value.
as_u64
Section titled “as_u64”The value of a uint64.
Returns
Option<u64> — The integer, or None for any other value.
as_f32
Section titled “as_f32”The value of a float.
Returns
Option<f32> — The float, or None for any other value.
as_bytes
Section titled “as_bytes”The bytes of a byte[].
Returns
Option<&[u8]> — The bytes, or None for any other value.
as_array
Section titled “as_array”The items of an array.
Returns
&[Self] — The items, or an empty slice for any other value, so a missing list reads as an empty one.
