1use std::fmt;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub struct InsufficientCapacity(pub u32);
11
12impl fmt::Display for InsufficientCapacity {
13 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14 write!(
15 f,
16 "required number of cells {} exceeds bucket's capacity",
17 self.0
18 )
19 }
20}
21
22#[cfg(feature = "std")]
23impl std::error::Error for InsufficientCapacity {}
24
25#[cfg(all(feature = "std", test))]
26mod test {
27 use super::*;
28
29 #[test]
30 fn coverage() {
31 let display_output = format!("{}", InsufficientCapacity(3));
32 assert!(display_output.contains("3"));
33 let debug_output = format!("{:?}", InsufficientCapacity(3));
34 assert!(debug_output.contains("3"));
35 assert_eq!(InsufficientCapacity(3), InsufficientCapacity(3));
36 }
37}