tuple: remove obsolete ExtendedTupleOps

replaced by iterators (generic composable `map` and `zip` adaptors)
This commit is contained in:
Daniel Micay 2013-08-13 21:00:58 -04:00
parent 6a21f22767
commit 1f89eb867a
2 changed files with 1 additions and 53 deletions

View file

@ -69,7 +69,7 @@ pub use str::{Str, StrVector, StrSlice, OwnedStr};
pub use from_str::FromStr;
pub use to_bytes::IterBytes;
pub use to_str::{ToStr, ToStrConsume};
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
pub use tuple::{CopyableTuple, ImmutableTuple};
pub use tuple::{CloneableTuple1, ImmutableTuple1};
pub use tuple::{CloneableTuple2, CloneableTuple3, CloneableTuple4, CloneableTuple5};
pub use tuple::{CloneableTuple6, CloneableTuple7, CloneableTuple8, CloneableTuple9};

View file

@ -13,9 +13,6 @@
#[allow(missing_doc)];
use clone::Clone;
use vec;
use vec::ImmutableVector;
use iterator::Iterator;
pub use self::inner::*;
@ -79,55 +76,6 @@ impl<T, U> ImmutableTuple<T, U> for (T, U) {
}
}
pub trait ExtendedTupleOps<A,B> {
fn zip(&self) -> ~[(A, B)];
fn map<C>(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C];
}
impl<'self,
A:Clone,
B:Clone>
ExtendedTupleOps<A,B> for
(&'self [A], &'self [B]) {
#[inline]
fn zip(&self) -> ~[(A, B)] {
match *self {
(ref a, ref b) => {
vec::zip_slice(*a, *b)
}
}
}
#[inline]
fn map<C>(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C] {
match *self {
(ref a, ref b) => {
a.iter().zip(b.iter()).map(|(aa, bb)| f(aa, bb)).collect()
}
}
}
}
impl<A:Clone, B:Clone> ExtendedTupleOps<A,B> for (~[A], ~[B]) {
#[inline]
fn zip(&self) -> ~[(A, B)] {
match *self {
(ref a, ref b) => {
vec::zip_slice(*a, *b)
}
}
}
#[inline]
fn map<C>(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C] {
match *self {
(ref a, ref b) => {
a.iter().zip(b.iter()).map(|(aa, bb)| f(aa, bb)).collect()
}
}
}
}
// macro for implementing n-ary tuple functions and operations
macro_rules! tuple_impls {