diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-04-24 17:44:04 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-04-24 17:44:45 +0200 |
commit | 4ee89363fb6d538e28dd9375e69580d139ddacea (patch) | |
tree | 2d07f72a4b3b54c806d298b718e782bd15b162bf | |
parent | 88d9c1b257d7519e43d36bcaef67588b9fa54c7e (diff) | |
download | servo-4ee89363fb6d538e28dd9375e69580d139ddacea.tar.gz servo-4ee89363fb6d538e28dd9375e69580d139ddacea.zip |
Define the binary search methods on [T] rather than &[T].
-rw-r--r-- | components/util/vec.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/components/util/vec.rs b/components/util/vec.rs index cce3e867676..5b26e6334a0 100644 --- a/components/util/vec.rs +++ b/components/util/vec.rs @@ -11,8 +11,8 @@ pub trait Comparator<K,T> { fn compare(&self, key: &K, value: &T) -> Ordering; } -pub trait BinarySearchMethods<'a, T: Ord + PartialOrd + PartialEq> { - fn binary_search_(&self, key: &T) -> Option<&'a T>; +pub trait BinarySearchMethods<T: Ord + PartialOrd + PartialEq> { + fn binary_search_(&self, key: &T) -> Option<&T>; fn binary_search_index(&self, key: &T) -> Option<usize>; } @@ -20,8 +20,8 @@ pub trait FullBinarySearchMethods<T> { fn binary_search_index_by<K,C:Comparator<K,T>>(&self, key: &K, cmp: C) -> Option<usize>; } -impl<'a, T: Ord + PartialOrd + PartialEq> BinarySearchMethods<'a, T> for &'a [T] { - fn binary_search_(&self, key: &T) -> Option<&'a T> { +impl<T: Ord + PartialOrd + PartialEq> BinarySearchMethods<T> for [T] { + fn binary_search_(&self, key: &T) -> Option<&T> { self.binary_search_index(key).map(|i| &self[i]) } @@ -30,7 +30,7 @@ impl<'a, T: Ord + PartialOrd + PartialEq> BinarySearchMethods<'a, T> for &'a [T] } } -impl<'a, T> FullBinarySearchMethods<T> for &'a [T] { +impl<T> FullBinarySearchMethods<T> for [T] { fn binary_search_index_by<K,C:Comparator<K,T>>(&self, key: &K, cmp: C) -> Option<usize> { if self.len() == 0 { return None; |