diff options
| author | blake2-ppc <blake2-ppc> | 2013-09-01 18:20:24 +0200 |
|---|---|---|
| committer | blake2-ppc <blake2-ppc> | 2013-09-01 18:20:24 +0200 |
| commit | 7c369ee7337cee50f8ef05b9d2833e2aa30d802e (patch) | |
| tree | f23d4238ab36002ed0274f775a9c27af2e15b68d /src/libextra | |
| parent | 35040dfccc6674e8eda71b34a8cd1b4cc1b45842 (diff) | |
| download | rust-7c369ee7337cee50f8ef05b9d2833e2aa30d802e.tar.gz rust-7c369ee7337cee50f8ef05b9d2833e2aa30d802e.zip | |
std/extra: Add ExactSize for Bitv, DList, RingBuf, Option iterators
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/bitv.rs | 2 | ||||
| -rw-r--r-- | src/libextra/dlist.rs | 3 | ||||
| -rw-r--r-- | src/libextra/ringbuf.rs | 4 |
3 files changed, 9 insertions, 0 deletions
diff --git a/src/libextra/bitv.rs b/src/libextra/bitv.rs index 63d62bd4809..03588d984d9 100644 --- a/src/libextra/bitv.rs +++ b/src/libextra/bitv.rs @@ -608,6 +608,8 @@ impl<'self> DoubleEndedIterator<bool> for BitvIterator<'self> { } } +impl<'self> ExactSize<bool> for BitvIterator<'self> {} + impl<'self> RandomAccessIterator<bool> for BitvIterator<'self> { #[inline] fn indexable(&self) -> uint { diff --git a/src/libextra/dlist.rs b/src/libextra/dlist.rs index 8e641073637..075a0fa7777 100644 --- a/src/libextra/dlist.rs +++ b/src/libextra/dlist.rs @@ -472,6 +472,8 @@ impl<'self, A> DoubleEndedIterator<&'self A> for DListIterator<'self, A> { } } +impl<'self, A> ExactSize<&'self A> for DListIterator<'self, A> {} + impl<'self, A> Iterator<&'self mut A> for MutDListIterator<'self, A> { #[inline] fn next(&mut self) -> Option<&'self mut A> { @@ -508,6 +510,7 @@ impl<'self, A> DoubleEndedIterator<&'self mut A> for MutDListIterator<'self, A> } } +impl<'self, A> ExactSize<&'self mut A> for MutDListIterator<'self, A> {} /// Allow mutating the DList while iterating pub trait ListInsertion<A> { diff --git a/src/libextra/ringbuf.rs b/src/libextra/ringbuf.rs index 4f2755374af..9ae9b47e207 100644 --- a/src/libextra/ringbuf.rs +++ b/src/libextra/ringbuf.rs @@ -243,6 +243,8 @@ pub struct RingBufIterator<'self, T> { iterator!{impl RingBufIterator -> &'self T, get_ref} iterator_rev!{impl RingBufIterator -> &'self T, get_ref} +impl<'self, T> ExactSize<&'self T> for RingBufIterator<'self, T> {} + impl<'self, T> RandomAccessIterator<&'self T> for RingBufIterator<'self, T> { #[inline] fn indexable(&self) -> uint { self.rindex - self.index } @@ -268,6 +270,8 @@ pub struct RingBufMutIterator<'self, T> { iterator!{impl RingBufMutIterator -> &'self mut T, get_mut_ref} iterator_rev!{impl RingBufMutIterator -> &'self mut T, get_mut_ref} +impl<'self, T> ExactSize<&'self mut T> for RingBufMutIterator<'self, T> {} + /// Grow is only called on full elts, so nelts is also len(elts), unlike /// elsewhere. fn grow<T>(nelts: uint, loptr: &mut uint, elts: &mut ~[Option<T>]) { |
