Operations on tuples
CopyableTuple
- Method extensions to pairs where both types satisfy the Copy
boundExtendedTupleOps
ImmutableTuple
- Method extensions for pairs where the types don't necessarily satisfy the Copy
boundof CopyableTuple<T, U> for (T, U) where <T: Copy, U: Copy>
of ImmutableTuple<T, U> for (T, U) where <T, U>
of ExtendedTupleOps<A, B> for (&'self [A], &'self [B]) where <'self, A: Copy, B: Copy>
of ExtendedTupleOps<A, B> for (~[A], ~[B]) where <A: Copy, B: Copy>
tuple::inner
CopyableTuple
Method extensions to pairs where both types satisfy the Copy
bound
first
fn first(&self) -> T
Return the first element of self
second
fn second(&self) -> U
Return the second element of self
swap
fn swap(&self) -> (U, T)
Return the results of swapping the two elements of self
ExtendedTupleOps
zip
fn zip(&self) -> ~[(A, B)]
map
fn map<C>(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C]
ImmutableTuple
Method extensions for pairs where the types don't necessarily satisfy the Copy
bound
first_ref
fn first_ref<'a>(&'a self) -> &'a T
Return a reference to the first element of self
second_ref
fn second_ref<'a>(&'a self) -> &'a U
Return a reference to the second element of self
CopyableTuple<T, U>
for (T, U)
where <T: Copy, U: Copy>
first
fn first(&self) -> T
Return the first element of self
second
fn second(&self) -> U
Return the second element of self
swap
fn swap(&self) -> (U, T)
Return the results of swapping the two elements of self
ImmutableTuple<T, U>
for (T, U)
where <T, U>
first_ref
fn first_ref<'a>(&'a self) -> &'a T
second_ref
fn second_ref<'a>(&'a self) -> &'a U
ExtendedTupleOps<A, B>
for (&'self [A], &'self [B])
where <'self, A: Copy, B: Copy>
zip
fn zip(&self) -> ~[(A, B)]
map
fn map<C>(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C]
ExtendedTupleOps<A, B>
for (~[A], ~[B])
where <A: Copy, B: Copy>
zip
fn zip(&self) -> ~[(A, B)]
map
fn map<C>(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C]