diff --git a/src/lib.rs b/src/lib.rs index 2dca9de..ad576c5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -705,7 +705,7 @@ impl> io::Write for ArrayVec { /// Error value indicating insufficient capacity #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] -pub struct CapacityError { +pub struct CapacityError { element: T, } @@ -720,6 +720,11 @@ impl CapacityError { pub fn element(self) -> T { self.element } + + /// Convert into a `CapacityError` that does not carry an element. + pub fn simplify(self) -> CapacityError { + CapacityError { element: () } + } } const CAPERROR: &'static str = "insufficient capacity";