Chris Morgan
›
Git
›
anymap
› commitdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6d0a64d
)
commit
grep
author
committer
pickaxe
?
search:
re
Ungate drain iterator (stable in Rust 1.6.0).
author
Chris Morgan
<me@chrismorgan.info>
Sat, 5 Mar 2016 01:58:49 +0000
committer
Chris Morgan
<me@chrismorgan.info>
Sat, 5 Mar 2016 01:58:49 +0000
src/raw.rs
patch
|
blob
|
history
diff --git
a/src/raw.rs
b/src/raw.rs
index 445b137cb9beb7f83c1610a2fd60fa040d49a6ff..6aed3e87f9916ed2a3af8fbbf929f06759498e75 100644
(file)
--- a/
src/raw.rs
+++ b/
src/raw.rs
@@
-106,17
+106,14
@@
impl<A: ?Sized + UncheckedAnyExt> ExactSizeIterator for IntoIter<A> {
}
/// RawMap drain iterator.
}
/// RawMap drain iterator.
-#[cfg(feature = "unstable")]
pub struct Drain<'a, A: ?Sized + UncheckedAnyExt> {
inner: hash_map::Drain<'a, TypeId, Box<A>>,
}
pub struct Drain<'a, A: ?Sized + UncheckedAnyExt> {
inner: hash_map::Drain<'a, TypeId, Box<A>>,
}
-#[cfg(feature = "unstable")]
impl<'a, A: ?Sized + UncheckedAnyExt> Iterator for Drain<'a, A> {
type Item = Box<A>;
#[inline] fn next(&mut self) -> Option<Box<A>> { self.inner.next().map(|x| x.1) }
#[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
}
impl<'a, A: ?Sized + UncheckedAnyExt> Iterator for Drain<'a, A> {
type Item = Box<A>;
#[inline] fn next(&mut self) -> Option<Box<A>> { self.inner.next().map(|x| x.1) }
#[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
}
-#[cfg(feature = "unstable")]
impl<'a, A: ?Sized + UncheckedAnyExt> ExactSizeIterator for Drain<'a, A> {
#[inline] fn len(&self) -> usize { self.inner.len() }
}
impl<'a, A: ?Sized + UncheckedAnyExt> ExactSizeIterator for Drain<'a, A> {
#[inline] fn len(&self) -> usize { self.inner.len() }
}
@@
-148,7
+145,6
@@
impl<A: ?Sized + UncheckedAnyExt> RawMap<A> {
///
/// Keeps the allocated memory for reuse.
#[inline]
///
/// Keeps the allocated memory for reuse.
#[inline]
- #[cfg(feature = "unstable")]
pub fn drain(&mut self) -> Drain<A> {
Drain {
inner: self.inner.drain(),
pub fn drain(&mut self) -> Drain<A> {
Drain {
inner: self.inner.drain(),