oct/error/
usize_encode_error.rs1use core::convert::Infallible;
10use core::error::Error;
11use core::fmt::{self, Display, Formatter};
12
13#[derive(Debug, Eq, PartialEq)]
17#[must_use]
18pub struct UsizeEncodeError(
19	pub usize,
21);
22
23impl Display for UsizeEncodeError {
24	#[inline]
25	fn fmt(&self, f: &mut Formatter) -> fmt::Result {
26		write!(
27			f,
28			"unsigned size value `{}` cannot be serialised: must be at most `{}`",
29			self.0,
30			u16::MAX,
31		)
32	}
33}
34
35impl Error for UsizeEncodeError { }
36
37impl From<Infallible> for UsizeEncodeError {
38	#[inline(always)]
39	fn from(_value: Infallible) -> Self {
40		unreachable!()
41	}
42}