use core::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct IndexOutOfBounds {
pub index: usize,
pub len: usize,
}
impl fmt::Display for IndexOutOfBounds {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
formatter,
"index {} is out of bounds for PagedVec of length {}",
self.index, self.len
)
}
}
#[cfg(feature = "std")]
impl std::error::Error for IndexOutOfBounds {}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PagedVecError {
ZeroPageSize,
}
impl fmt::Display for PagedVecError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::ZeroPageSize => formatter.write_str("page size must be greater than zero"),
}
}
}
#[cfg(feature = "std")]
impl std::error::Error for PagedVecError {}