Guest User

Untitled

a guest
Dec 9th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. use std::ops::Deref;
  2.  
  3. struct TombstoneIterator<I, T> {
  4. iter: I,
  5. tombstone_value: T,
  6. }
  7.  
  8. impl<I, T> TombstoneIterator<I, T> {
  9. fn new(iter: I, tombstone_value: T) -> Self
  10. where
  11. I: Iterator,
  12. I::Item: Deref<Target=T>,
  13. {
  14. TombstoneIterator {
  15. iter,
  16. tombstone_value,
  17. }
  18. }
  19. }
  20.  
  21. #[cfg(test)]
  22. mod tests {
  23. use super::*;
  24.  
  25. #[test]
  26. fn tombstone_iter_works() {
  27. let string = String::from("..foo...bar..");
  28. let iter = TombstoneIterator::new(string.chars(), '.');
  29. }
  30.  
  31. #[test]
  32. fn tombstone_iter_mut_works() {
  33. let mut string: Vec<_> = "..foo...bar..".chars().collect();
  34. let iter = TombstoneIterator::new(string.iter_mut(), '.');
  35. }
  36. }
Add Comment
Please, Sign In to add comment