Function not_enough_bytes_err

Source
pub fn not_enough_bytes_err<T: NotEnoughBytesErr>(
    context: &'static str,
    received: usize,
    expected: usize,
) -> T
Expand description

Helper function to create a “not enough bytes” error.

This function is a convenience wrapper around the NotEnoughBytesErr trait.

§Arguments

  • context - The context in which the error occurred.
  • received - The number of bytes received.
  • expected - The number of bytes expected.

§Returns

A new error instance of type T that implements NotEnoughBytesErr.