diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-11-21 17:10:42 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-11-25 11:22:23 -0500 |
| commit | 3293ab14e24d136d0482bb18afef577aebed251e (patch) | |
| tree | c21d2568d6eaf1cc1835034cf2557277c4e8d58b /src/libcollections/hash | |
| parent | 48ca6d1840818e4a8977d00ed62cf0e8e0e5d193 (diff) | |
| download | rust-3293ab14e24d136d0482bb18afef577aebed251e.tar.gz rust-3293ab14e24d136d0482bb18afef577aebed251e.zip | |
Deprecate MaybeOwned[Vector] in favor of Cow
Diffstat (limited to 'src/libcollections/hash')
| -rw-r--r-- | src/libcollections/hash/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcollections/hash/mod.rs b/src/libcollections/hash/mod.rs index b1ff3da947b..4173ffc5d2f 100644 --- a/src/libcollections/hash/mod.rs +++ b/src/libcollections/hash/mod.rs @@ -67,6 +67,7 @@ use core::prelude::*; use alloc::boxed::Box; use alloc::rc::Rc; +use core::borrow::{Cow, ToOwned}; use core::intrinsics::TypeId; use core::mem; use core::num::Int; @@ -284,6 +285,13 @@ impl<S: Writer, T: Hash<S>, U: Hash<S>> Hash<S> for Result<T, U> { } } +impl<'a, T, Sized? B, S> Hash<S> for Cow<'a, T, B> where B: Hash<S> + ToOwned<T> { + #[inline] + fn hash(&self, state: &mut S) { + Hash::hash(&**self, state) + } +} + ////////////////////////////////////////////////////////////////////////////// #[cfg(test)] |
