Find the longest symbol matching at position `pos` in `data`. Returns the match length (0 if no match).
(symbols: &[Vec<u8>], data: &[u8], pos: usize)
| 136 | /// Find the longest symbol matching at position `pos` in `data`. |
| 137 | /// Returns the match length (0 if no match). |
| 138 | fn longest_symbol_match(symbols: &[Vec<u8>], data: &[u8], pos: usize) -> usize { |
| 139 | let remaining = &data[pos..]; |
| 140 | for sym in symbols { |
| 141 | if remaining.starts_with(sym) { |
| 142 | return sym.len(); |
| 143 | } |
| 144 | } |
| 145 | 0 |
| 146 | } |
| 147 | |
| 148 | // --------------------------------------------------------------------------- |
| 149 | // Public encode / decode API |