non_empty_collections/
error.rs1use std::error::Error as StdError;
2use std::fmt;
3
4#[derive(Debug, Clone, Copy, PartialEq)]
6pub enum Error {
7 EmptyCollection,
9}
10
11impl fmt::Display for Error {
12 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
13 match self {
14 Error::EmptyCollection => write!(
15 f,
16 "An attempt to create an empty non-empty-collection has been made"
17 ),
18 }
19 }
20}
21
22impl StdError for Error {
23 fn description(&self) -> &str {
24 match self {
25 Error::EmptyCollection => {
26 "An attempt to create an empty non-empty-collection has been made"
27 }
28 }
29 }
30}