Use no public fields for CapacityError

This commit is contained in:
bluss
2015-09-18 01:00:55 +02:00
parent 90de29e6cb
commit 7b47f1e891
2 changed files with 10 additions and 6 deletions
+7 -3
View File
@@ -36,19 +36,23 @@ unsafe fn new_array<A: Array>() -> A {
mem::uninitialized()
}
/// Error value indicating insufficient capacity
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct CapacityError<T> {
_unused: (),
pub element: T,
element: T,
}
impl<T> CapacityError<T> {
fn new(element: T) -> CapacityError<T> {
CapacityError {
_unused: (),
element: element,
}
}
/// Extract the overflowing element
pub fn element(self) -> T {
self.element
}
}
/// A vector with a fixed capacity.