Function decode_append
pub fn decode_append<B>(
input: impl AsRef<[u8]>,
output: &mut B,
) -> Result<usize, DecodeError>Expand description
Append decoded bytes to a collection, returning the number supplied to it.
Does not clear the collection and lets it allocate as needed. The count is decoded bytes, even if a collection such as a set discards duplicates. Malformed input leaves the collection unchanged.
use rama_utils::hex;
let mut bytes = vec![1];
assert_eq!(hex::decode_append("00ab", &mut bytes)?, 2);
assert_eq!(bytes, [1, 0, 0xab]);