diff options
Diffstat (limited to 'src/libstd/tuple.rs')
| -rw-r--r-- | src/libstd/tuple.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/tuple.rs b/src/libstd/tuple.rs index 639df89a377..da2c52014e8 100644 --- a/src/libstd/tuple.rs +++ b/src/libstd/tuple.rs @@ -10,14 +10,20 @@ //! Operations on tuples +#[allow(missing_doc)]; + use kinds::Copy; use vec; pub use self::inner::*; +/// Method extensions to pairs where both types satisfy the `Copy` bound pub trait CopyableTuple<T, U> { + /// Return the first element of self fn first(&self) -> T; + /// Return the second element of self fn second(&self) -> U; + /// Return the results of swapping the two elements of self fn swap(&self) -> (U, T); } @@ -47,8 +53,12 @@ impl<T:Copy,U:Copy> CopyableTuple<T, U> for (T, U) { } } +/// Method extensions for pairs where the types don't necessarily satisfy the +/// `Copy` bound pub trait ImmutableTuple<T, U> { + /// Return a reference to the first element of self fn first_ref<'a>(&'a self) -> &'a T; + /// Return a reference to the second element of self fn second_ref<'a>(&'a self) -> &'a U; } |
