//! up to a certain length. Eventually we should able to generalize
//! to all lengths.
-#![experimental] // not yet reviewed
+#![unstable] // not yet reviewed
use clone::Clone;
use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
use fmt;
-use kinds::Copy;
-use ops::Deref;
+use hash::{Hash, Hasher, self};
+use marker::Copy;
+use ops::{Deref, FullRange};
use option::Option;
// macro for implementing n-ary tuple functions and operations
}
}
- #[unstable = "waiting for Show to stabilize"]
- impl<T:fmt::Show> fmt::Show for [T; $N] {
+ impl<S: hash::Writer + Hasher, T: Hash<S>> Hash<S> for [T; $N] {
+ fn hash(&self, state: &mut S) {
+ Hash::hash(&self[], state)
+ }
+ }
+
+ #[stable]
+ impl<T: fmt::Debug> fmt::Debug for [T; $N] {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- fmt::Show::fmt(&self[], f)
+ fmt::Debug::fmt(&&self[], f)
}
}
impl<A, B> PartialEq<[B; $N]> for [A; $N] where A: PartialEq<B> {
#[inline]
fn eq(&self, other: &[B; $N]) -> bool {
- self[] == other[]
+ &self[] == &other[]
}
#[inline]
fn ne(&self, other: &[B; $N]) -> bool {
- self[] != other[]
+ &self[] != &other[]
}
}
#[stable]
impl<'a, A, B, Rhs> PartialEq<Rhs> for [A; $N] where
A: PartialEq<B>,
- Rhs: Deref<[B]>,
+ Rhs: Deref<Target=[B]>,
{
#[inline(always)]
- fn eq(&self, other: &Rhs) -> bool { PartialEq::eq(self[], &**other) }
+ fn eq(&self, other: &Rhs) -> bool {
+ PartialEq::eq(&self[], &**other)
+ }
#[inline(always)]
- fn ne(&self, other: &Rhs) -> bool { PartialEq::ne(self[], &**other) }
+ fn ne(&self, other: &Rhs) -> bool {
+ PartialEq::ne(&self[], &**other)
+ }
}
#[stable]
impl<'a, A, B, Lhs> PartialEq<[B; $N]> for Lhs where
A: PartialEq<B>,
- Lhs: Deref<[A]>
+ Lhs: Deref<Target=[A]>
{
#[inline(always)]
- fn eq(&self, other: &[B; $N]) -> bool { PartialEq::eq(&**self, other[]) }
+ fn eq(&self, other: &[B; $N]) -> bool {
+ PartialEq::eq(&**self, &other[])
+ }
#[inline(always)]
- fn ne(&self, other: &[B; $N]) -> bool { PartialEq::ne(&**self, other[]) }
+ fn ne(&self, other: &[B; $N]) -> bool {
+ PartialEq::ne(&**self, &other[])
+ }
}
#[stable]
impl<T:PartialOrd> PartialOrd for [T; $N] {
#[inline]
fn partial_cmp(&self, other: &[T; $N]) -> Option<Ordering> {
- PartialOrd::partial_cmp(&self[], &other[])
+ PartialOrd::partial_cmp(&&self[], &&other[])
}
#[inline]
fn lt(&self, other: &[T; $N]) -> bool {
- PartialOrd::lt(&self[], &other[])
+ PartialOrd::lt(&&self[], &&other[])
}
#[inline]
fn le(&self, other: &[T; $N]) -> bool {
- PartialOrd::le(&self[], &other[])
+ PartialOrd::le(&&self[], &&other[])
}
#[inline]
fn ge(&self, other: &[T; $N]) -> bool {
- PartialOrd::ge(&self[], &other[])
+ PartialOrd::ge(&&self[], &&other[])
}
#[inline]
fn gt(&self, other: &[T; $N]) -> bool {
- PartialOrd::gt(&self[], &other[])
+ PartialOrd::gt(&&self[], &&other[])
}
}
impl<T:Ord> Ord for [T; $N] {
#[inline]
fn cmp(&self, other: &[T; $N]) -> Ordering {
- Ord::cmp(&self[], &other[])
+ Ord::cmp(&&self[], &&other[])
}
}
)+