use std::fmt;
#[cfg(feature="std")]
use std::any::Any;
#[cfg(feature="std")]
use std::error::Error;
#[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
pub struct CapacityError<T = ()> {
    element: T,
}
impl<T> CapacityError<T> {
    pub const fn new(element: T) -> CapacityError<T> {
        CapacityError {
            element: element,
        }
    }
    pub fn element(self) -> T {
        self.element
    }
    pub fn simplify(self) -> CapacityError {
        CapacityError { element: () }
    }
}
const CAPERROR: &'static str = "insufficient capacity";
#[cfg(feature="std")]
impl<T: Any> Error for CapacityError<T> {}
impl<T> fmt::Display for CapacityError<T> {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", CAPERROR)
    }
}
impl<T> fmt::Debug for CapacityError<T> {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}: {}", "CapacityError", CAPERROR)
    }
}