vu128

Function encode_i32

Source
pub fn encode_i32(buf: &mut [u8; 5], value: i32) -> usize
Expand description

Encodes an i32 into a buffer, returning the encoded length.

The contents of the buffer beyond the returned length are unspecified.

ยงExamples

let mut buf = [0u8; 5];
let encoded_len = vu128::encode_i32(&mut buf, 123);
assert_eq!(&buf[..encoded_len], &[0xB6, 0x03]);