Skip to main content

member_value

Function member_value 

Source
pub fn member_value<'a, V: Source>(
    object: Fields<'a, V>,
    member: &Member,
    path: &str,
) -> Result<Option<&'a V>, ProbeError>
Expand description

The value for one member, or None where an @optional is absent.

The two rules the corpus README states, in the one place all three backends ask:

  • a member with no key is absent, which only an @optional may be;
  • null is never a value and never an absence. An absent optional member is a key that is left out. null would read as “present and empty” to one backend and as “absent” to another, and the vendors write nothing at all for an absent optional — measured across all three, vendor_bytes.md §“Everything else all three agree on”.

§Errors

ProbeError::Missing for a required member with no key, ProbeError::Mismatch for null.