byteorder_cursor/
error.rs

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