padded_iterator/utils.rs
1//! Utility functions for the crate
2//!
3//! Contains an enum of errors that can occur when building a padded iterator.
4
5use std::fmt::{Display, Formatter, Result};
6
7/// An error that can occur when building a padded iterator.
8#[derive(Debug, PartialEq)]
9pub enum BuildError {
10
11 /// The iterator was not set.
12 IterNotSet,
13 /// The length was not set.
14 LengthNotSet,
15 /// The pad was not set.
16 PadNotSet,
17}
18
19impl Display for BuildError {
20 fn fmt(&self, f: &mut Formatter) -> Result {
21 match self {
22 BuildError::IterNotSet => write!(f, "Iterator not set"),
23 BuildError::LengthNotSet => write!(f, "Length not set"),
24 BuildError::PadNotSet => write!(f, "Pad not set"),
25 }
26 }
27}
28
29impl std::error::Error for BuildError {}