Skip to main content

get_namespace

Function get_namespace 

Source
fn get_namespace(pairs: &[(Value, Value)]) -> Option<Vec<Vec<u8>>>
Expand description

Read a track namespace: an array of byte strings, tolerating text entries from encoders that lose the distinction.

Answers None for anything else — a "ns" that is not an array, or an array holding something that is neither bytes nor text. "ns" is optional, and the rule for an optional key whose value this reader cannot use is that the key is kept as an unrecognised one rather than that the event dies; the caller then still has the derivation’s upstream and downstream subscriptions, which are what make it a derivation at all.

It used to return an error, which cost more than the field. read_next propagates it, so collect::<Result<Vec<_>, _>>() — the documented idiom — stopped at that event and yielded none of the ones after it. One namespace an encoder wrote oddly took the rest of the recording with it.