Skip to main content

check_encoder

Function check_encoder 

Source
pub fn check_encoder<T: Encoder + ?Sized>(encoder: &mut T, expected: &[u8])
Expand description

Checks that the given encoder yields 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 don’t match the bytes in expected.