Attempt to auto-detect whether the input has a length prefix or not First tries to parse as length-prefixed, then falls back to raw TLV parsing.
(bytes: &[u8])
| 114 | /// First tries to parse as length-prefixed, then falls back to raw TLV |
| 115 | /// parsing. |
| 116 | pub fn from_bytes_auto(bytes: &[u8]) -> Result<Self> { |
| 117 | // Try length-prefixed first |
| 118 | if let Ok(stream) = Self::from_bytes_with_length_prefix(bytes) { |
| 119 | return Ok(stream); |
| 120 | } |
| 121 | |
| 122 | // Fall back to raw TLV parsing |
| 123 | Self::from_bytes(bytes) |
| 124 | } |
| 125 | |
| 126 | /// Get a reference to the value of a TLV record by type. |
| 127 | pub fn get(&self, type_: u64) -> Option<&[u8]> { |
nothing calls this directly
no outgoing calls
no test coverage detected