pub struct Pair<'a> {
pub key: Option<&'a [u8]>,
pub key_offset: usize,
pub offset: usize,
pub value: &'a [u8],
pub kind: Kind,
}Expand description
One key-value pair, or one array element, from iterate.
Fields§
§key: Option<&'a [u8]>The key, with its quotes stripped — or None for an array element.
The C signals “no key” with a NULL pointer, and derives it from the key
index being zero. That conflation is harmless there because an object’s
first key can never start at offset 0 (a { precedes it), and it is
reproduced here exactly rather than improved on.
key_offset: usizeWhere the key starts, or 0 when there is none.
The C hands back a pointer and leaves the caller to subtract; carrying the index means nobody has to do pointer arithmetic to find out where a key was. The first version of the differential did exactly that, and needing it was the sign this field was missing.
offset: usizeWhere the value starts, with the same string adjustment as Match.
value: &'a [u8]The value itself.
kind: KindWhat kind of value it is.