Skip to main content

check_encode

Function check_encode 

Source
pub fn check_encode<T: Encode + ?Sized>(value: &T, expected: &[u8])
Expand description

Checks that the given value encodes to expected, panicking if it doesn’t.

Note that the function does not impose any requirements on chunking - whether the encoded bytes are returned as a few large chunks or they are many smaller chunks makes no difference (other than potentially performance difference), as long as the bytes yielded are what is expected, in the correct order.

This is intended for tests only.

§Panics

If the bytes yielded from the encoder of value don’t match the bytes in expected.