Skip to content

Commit e33de4b

Browse files
authored
Merge pull request #70 from bluss/capacity-error-new
Add CapacityError::new
2 parents 1a202a9 + 9825e58 commit e33de4b

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

src/array_string.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use std::slice;
1212
use array::{Array, ArrayExt};
1313
use array::Index;
1414
use CapacityError;
15-
use errors::PubCrateNew;
1615
use odds::char::encode_utf8;
1716

1817
#[cfg(feature="serde-1")]

src/errors.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,14 @@ pub struct CapacityError<T = ()> {
1010
element: T,
1111
}
1212

13-
pub trait PubCrateNew<T> {
14-
fn new(elt: T) -> Self;
15-
}
16-
17-
impl<T> PubCrateNew<T> for CapacityError<T> {
18-
fn new(element: T) -> CapacityError<T> {
13+
impl<T> CapacityError<T> {
14+
/// Create a new `CapacityError` from `element`.
15+
pub fn new(element: T) -> CapacityError<T> {
1916
CapacityError {
2017
element: element,
2118
}
2219
}
23-
}
2420

25-
impl<T> CapacityError<T> {
2621
/// Extract the overflowing element
2722
pub fn element(self) -> T {
2823
self.element

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ pub use array::Array;
6969
pub use range::RangeArgument;
7070
use array::Index;
7171
pub use array_string::ArrayString;
72-
use errors::PubCrateNew;
7372
pub use errors::CapacityError;
7473

7574

0 commit comments

Comments
 (0)