Get a reference to the value of a TLV record by type.
(&self, type_: u64)
| 125 | |
| 126 | /// Get a reference to the value of a TLV record by type. |
| 127 | pub fn get(&self, type_: u64) -> Option<&[u8]> { |
| 128 | self.0 |
| 129 | .iter() |
| 130 | .find(|rec| rec.type_ == type_) |
| 131 | .map(|rec| rec.value.as_slice()) |
| 132 | } |
| 133 | |
| 134 | /// Insert a TLV record (replaces if type already exists). |
| 135 | pub fn insert(&mut self, type_: u64, value: Vec<u8>) { |