Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::ops::Deref;
- struct TombstoneIterator<I, T> {
- iter: I,
- tombstone_value: T,
- }
- impl<I, T> TombstoneIterator<I, T> {
- fn new(iter: I, tombstone_value: T) -> Self
- where
- I: Iterator,
- I::Item: Deref<Target=T>,
- {
- TombstoneIterator {
- iter,
- tombstone_value,
- }
- }
- }
- #[cfg(test)]
- mod tests {
- use super::*;
- #[test]
- fn tombstone_iter_works() {
- let string = String::from("..foo...bar..");
- let iter = TombstoneIterator::new(string.chars(), '.');
- }
- #[test]
- fn tombstone_iter_mut_works() {
- let mut string: Vec<_> = "..foo...bar..".chars().collect();
- let iter = TombstoneIterator::new(string.iter_mut(), '.');
- }
- }
Add Comment
Please, Sign In to add comment