pub struct FieldMap { /* private fields */ }Expand description
A decoded message’s fields, in the order the draft defines them.
Ordered rather than sorted because the order is information: it is the order the fields appear on the wire, which is what makes a rendering of one message comparable to a rendering of the same message from another implementation.
Implementations§
Source§impl FieldMap
impl FieldMap
Sourcepub fn insert(&mut self, key: String, value: FieldValue)
pub fn insert(&mut self, key: String, value: FieldValue)
Set key to value, replacing any value already under that key.
Replacing rather than appending keeps a duplicate key impossible, which is what lets a reader index the map. A replaced key keeps its original position, so a later correction does not reorder the message.
The key is a String rather than an impl Into<String> because the
callers write "request_id".into(), and a generic bound leaves that
into with nothing to infer from.
Sourcepub fn get(&self, key: &str) -> Option<&FieldValue>
pub fn get(&self, key: &str) -> Option<&FieldValue>
The value under key, if the message carried that field.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &FieldValue)>
pub fn iter(&self) -> impl Iterator<Item = (&str, &FieldValue)>
The fields, in the order the draft defines them.