diff --git a/src/internals/iterator.rs b/src/internals/iterator.rs index 1f31241..2dc8ff8 100644 --- a/src/internals/iterator.rs +++ b/src/internals/iterator.rs @@ -35,10 +35,54 @@ pub trait MemoryBlockIterator { fn next(&mut self) -> Option; } +impl MemoryBlockIterator for Box +where + T: MemoryBlockIterator, +{ + fn first(&mut self) -> Option { + (**self).first() + } + + fn next(&mut self) -> Option { + (**self).next() + } +} + +impl MemoryBlockIterator for &mut T +where + T: MemoryBlockIterator, +{ + fn first(&mut self) -> Option { + (**self).first() + } + + fn next(&mut self) -> Option { + (**self).next() + } +} + pub trait MemoryBlockIteratorSized: MemoryBlockIterator { fn file_size(&mut self) -> u64; } +impl MemoryBlockIteratorSized for Box +where + T: MemoryBlockIteratorSized, +{ + fn file_size(&mut self) -> u64 { + (**self).file_size() + } +} + +impl MemoryBlockIteratorSized for &mut T +where + T: MemoryBlockIteratorSized, +{ + fn file_size(&mut self) -> u64 { + (**self).file_size() + } +} + #[derive(Debug)] pub struct WrapperMemoryBlockIterator { iter: T,