1#[cfg(feature = "std")]
2use std::error::Error;
3use std::fmt;
4
5#[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
9pub struct CapacityError<T = ()> {
10 pub element: T,
12}
13
14const CAPERROR: &str = "insufficient capacity";
15
16#[cfg(feature = "std")]
17impl<T> Error for CapacityError<T> {}
18
19impl<T> fmt::Display for CapacityError<T> {
20 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
21 f.write_str(CAPERROR)
22 }
23}
24
25impl<T> fmt::Debug for CapacityError<T> {
26 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
27 write!(f, "CapacityError: {}", CAPERROR)
28 }
29}