byteorder_cursor/error.rs
1use core::fmt::{Display, Formatter, Result};
2#[cfg(not(feature = "std"))]
3use core::{fmt::Debug, prelude::rust_2021::derive};
4
5/// Error returned if the supplied buffer is too small.
6#[derive(Clone, Debug)]
7pub struct BufferTooSmall {
8 pub size: usize,
9 pub expected: usize,
10}
11
12impl Display for BufferTooSmall {
13 fn fmt(&self, f: &mut Formatter) -> Result {
14 write!(
15 f,
16 "The supplied buffer is to small. Got {}, expected at least {}",
17 self.size, self.expected,
18 )
19 }
20}