pub fn encode_ctx_unsigned_to_sink<S: EncodeSink + ?Sized>(
sink: &mut S,
tag: u8,
value: u64,
) -> Result<usize, SinkFull>Expand description
Append a context-tagged Unsigned with its minimum-width contents.
Stages the whole value for one write, with the scalar sink contract. The tag number keeps its existing unvalidated input behavior.
use bacnet_encoding::primitives::encode_ctx_unsigned_to_sink;
let mut storage = [0xA5; 4];
let mut tail = &mut storage[..];
assert_eq!(encode_ctx_unsigned_to_sink(&mut tail, 15, 256)?, 4);
assert!(tail.is_empty());
assert_eq!(storage, [0xFA, 0x0F, 0x01, 0x00]);