1use std::error::Error;
2use std::fmt::{self, Display, Formatter};
34#[derive(#[automatically_derived]
impl ::core::fmt::Debug for IndexOutOfBounds {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"IndexOutOfBounds", "index", &self.index, "len", &&self.len)
}
}Debug)]
5pub struct IndexOutOfBounds {
6pub index: usize,
7pub len: usize,
8}
910impl Display for IndexOutOfBounds {
11fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
12f.write_fmt(format_args!("Index {0} out of bounds for collection with {1} elements!",
self.index, self.len))write!(f, "Index {} out of bounds for collection with {} elements!", self.index, self.len)13 }
14}
1516impl Error for IndexOutOfBounds {}
1718/// TODO
19///
20/// Note: This error is no longer returned by any public part of the API, but it is thrown during
21/// panics. This is because a capacity overflow has such a small chance of occurring that it isn't
22/// worth handling in most placed. Most machines wouldn't have enough memory to overflow a non-ZST
23/// collection with a u64 length.
24#[derive(#[automatically_derived]
impl ::core::fmt::Debug for CapacityOverflow {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f, "CapacityOverflow")
}
}Debug)]
25pub struct CapacityOverflow;
2627impl Display for CapacityOverflow {
28fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
29f.write_fmt(format_args!("Capacity overflow!"))write!(f, "Capacity overflow!")30 }
31}
3233impl Error for CapacityOverflow {}
3435#[derive(#[automatically_derived]
impl ::core::fmt::Debug for NoValueForKey {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f, "NoValueForKey")
}
}Debug)]
36pub struct NoValueForKey;
3738impl Display for NoValueForKey {
39fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
40f.write_fmt(format_args!("No values is associated with the provided key."))write!(f, "No values is associated with the provided key.")41 }
42}
4344impl Error for NoValueForKey {}