Insert or override a `tu64` value for `type_` (keeps canonical TLV order).
(&mut self, type_: u64, value: u64)
| 159 | |
| 160 | /// Insert or override a `tu64` value for `type_` (keeps canonical TLV order). |
| 161 | pub fn set_tu64(&mut self, type_: u64, value: u64) { |
| 162 | let enc = encode_tu64(value); |
| 163 | if let Some(rec) = self.0.iter_mut().find(|r| r.type_ == type_) { |
| 164 | rec.value = enc; |
| 165 | } else { |
| 166 | self.0.push(TlvRecord { type_, value: enc }); |
| 167 | self.0.sort_by_key(|r| r.type_); |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | /// Read a `tu64` if present, validating minimal encoding. |
| 172 | /// Returns Ok(None) if the type isn't present. |