pub struct Record<'a> { /* private fields */ }Expand description
A record: positional or keyed. Copyable, zero-copy accessors. A
sub-unit is not a unit of the record: fields, values and pairs
list the units; Record::unit and Record::get_unit give a unit
with its sub-units.
Implementations§
Source§impl<'a> Record<'a>
impl<'a> Record<'a>
Sourcepub fn keyed(&self) -> bool
pub fn keyed(&self) -> bool
Whether the record is keyed (its first unit, live or dead, is an SOH).
Sourcepub fn field(&self, n: usize) -> &'a [u8] ⓘ
pub fn field(&self, n: usize) -> &'a [u8] ⓘ
Raw slice of unit n (layout at its edges included, its sub-units
not); empty when there is no such unit.
Sourcepub fn field_count(&self) -> usize
pub fn field_count(&self) -> usize
Number of positional units (0 for a keyed record). A sub-unit is not counted.
Sourcepub fn unit(&self, n: usize) -> Option<Unit<'a>>
pub fn unit(&self, n: usize) -> Option<Unit<'a>>
Positional unit n with its sub-units, or None when there is no
such unit.
Sourcepub fn value(&self, n: usize) -> Result<Cow<'a, [u8]>>
pub fn value(&self, n: usize) -> Result<Cow<'a, [u8]>>
Logical value of unit n: text decoded, layout trimmed.
Sourcepub fn list(&self, n: usize) -> Result<Vec<Cow<'a, [u8]>>>
pub fn list(&self, n: usize) -> Result<Vec<Cow<'a, [u8]>>>
Unit n as a flat list: a level holding exactly one positional
record (an empty level is the empty list).
Sourcepub fn get_unit(&self, key: &str) -> Option<Unit<'a>>
pub fn get_unit(&self, key: &str) -> Option<Unit<'a>>
The unit under a key with its sub-units (last wins), or None.
Sourcepub fn get(&self, key: &str) -> Result<Option<Cow<'a, [u8]>>>
pub fn get(&self, key: &str) -> Result<Option<Cow<'a, [u8]>>>
Logical value for a key (last wins), or None.
Sourcepub fn get_level(&self, key: &str) -> Result<Option<Body<'a>>>
pub fn get_level(&self, key: &str) -> Result<Option<Body<'a>>>
The value for a key as a nested level, or None.