Insert or override a `u64` value for `type_` (keeps cannonical TLV order).
(&mut self, type_: u64, value: u64)
| 181 | /// Insert or override a `u64` value for `type_` (keeps cannonical TLV |
| 182 | /// order). |
| 183 | pub fn set_u64(&mut self, type_: u64, value: u64) { |
| 184 | let enc = value.to_be_bytes().to_vec(); |
| 185 | if let Some(rec) = self.0.iter_mut().find(|r| r.type_ == type_) { |
| 186 | rec.value = enc; |
| 187 | } else { |
| 188 | self.0.push(TlvRecord { type_, value: enc }); |
| 189 | self.0.sort_by_key(|r| r.type_); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | /// Read a `u64` if present.Returns Ok(None) if the type isn't present. |
| 194 | pub fn get_u64(&self, type_: u64) -> Result<Option<u64>> { |