1use std::{error, fmt};
8
9#[derive(Debug)]
14pub(crate) struct ReadExactError {
15 pub(crate) remaining: u64,
16 pub(crate) buf_len: usize,
17}
18
19impl error::Error for ReadExactError {
20 fn source(&self) -> Option<&(dyn error::Error + 'static)> {
21 None
22 }
23}
24
25impl fmt::Display for ReadExactError {
26 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27 write!(
28 f,
29 "Cursor had {} bytes remaining but buffer was {} bytes long",
30 self.remaining, self.buf_len
31 )
32 }
33}