diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-10-30 13:43:24 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-11-01 11:37:04 -0700 |
| commit | 21ac985af44f4e2470ef6f4c0eb4d72daf5a6497 (patch) | |
| tree | a120c184188926cd154b40f9da77ad8a6a455c1b /src/libgraphviz | |
| parent | 1442235d3feab4c5ca3f55e2b3345583f640a17e (diff) | |
| download | rust-21ac985af44f4e2470ef6f4c0eb4d72daf5a6497.tar.gz rust-21ac985af44f4e2470ef6f4c0eb4d72daf5a6497.zip | |
collections: Remove all collections traits
As part of the collections reform RFC, this commit removes all collections traits in favor of inherent methods on collections themselves. All methods should continue to be available on all collections. This is a breaking change with all of the collections traits being removed and no longer being in the prelude. In order to update old code you should move the trait implementations to inherent implementations directly on the type itself. Note that some traits had default methods which will also need to be implemented to maintain backwards compatibility. [breaking-change] cc #18424
Diffstat (limited to 'src/libgraphviz')
| -rw-r--r-- | src/libgraphviz/maybe_owned_vec.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/libgraphviz/maybe_owned_vec.rs b/src/libgraphviz/maybe_owned_vec.rs index a4d794d1f99..d465d140751 100644 --- a/src/libgraphviz/maybe_owned_vec.rs +++ b/src/libgraphviz/maybe_owned_vec.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::collections::Collection; use std::default::Default; use std::fmt; use std::iter::FromIterator; @@ -62,6 +61,10 @@ impl<'a,T> MaybeOwnedVector<'a,T> { &Borrowed(ref v) => v.iter(), } } + + pub fn len(&self) -> uint { self.as_slice().len() } + + pub fn is_empty(&self) -> bool { self.len() == 0 } } impl<'a, T: PartialEq> PartialEq for MaybeOwnedVector<'a, T> { @@ -145,12 +148,6 @@ impl<'a, T> Default for MaybeOwnedVector<'a, T> { } } -impl<'a, T> Collection for MaybeOwnedVector<'a, T> { - fn len(&self) -> uint { - self.as_slice().len() - } -} - impl<'a> BytesContainer for MaybeOwnedVector<'a, u8> { fn container_as_bytes<'a>(&'a self) -> &'a [u8] { self.as_slice() |
