Trait delta_encoding::DeltaDecoderExt
source · [−]pub trait DeltaDecoderExt: Iterator where
<Self as Iterator>::Item: Default + Copy + WrappingAdd, {
fn original(self) -> DeltaDecoderIter<Self>ⓘNotable traits for DeltaDecoderIter<I>impl<I> Iterator for DeltaDecoderIter<I> where
I: Iterator,
<I as Iterator>::Item: WrappingAdd + Copy, type Item = I::Item;
where
Self: Sized,
{ ... }
}
Provided Methods
fn original(self) -> DeltaDecoderIter<Self>ⓘNotable traits for DeltaDecoderIter<I>impl<I> Iterator for DeltaDecoderIter<I> where
I: Iterator,
<I as Iterator>::Item: WrappingAdd + Copy, type Item = I::Item;
where
Self: Sized,
fn original(self) -> DeltaDecoderIter<Self>ⓘNotable traits for DeltaDecoderIter<I>impl<I> Iterator for DeltaDecoderIter<I> where
I: Iterator,
<I as Iterator>::Item: WrappingAdd + Copy, type Item = I::Item;
where
Self: Sized,
I: Iterator,
<I as Iterator>::Item: WrappingAdd + Copy, type Item = I::Item;
Construct a delta-decoded iterator from an iterator.
The first element of the iterator is used as the starting point for the delta-encoding.
Note that unlike the [DeltaDecoder.decode
] method, this method will panic if the delta is too large.
Example
use delta_encoding::DeltaDecoderExt;
// Consuming original data into a delta-decoded iterator.
let mut decoded: Vec<i64> = vec![1, 1, 3, -1, -2].into_iter().original().collect();
assert_eq!(decoded, vec![1, 2, 5, 4, 2]);
// Non-consuming original data, but avoiding the allocation of a new vector.
let mut decoded: Vec<i64> = vec![1, 1, 3, -1, -2].iter().copied().original().collect();
assert_eq!(decoded, vec![1, 2, 5, 4, 2]);