Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

VictorBulba/sorted_intersection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intersection iterator over sorted iterators

Iterator with items that are contained in all inner iterators i. e. intersection iterator

Example

use sorted_intersection::SortedIntersection;

let numbers1 = vec![3, 6, 9, 18, 19, 21, 23, 27];
let numbers2 = vec![6, 7, 8, 9, 18];
let numbers3 = vec![5, 6, 9, 18, 25, 27];
let mut iters = [numbers1.iter(), numbers2.iter(), numbers3.iter()];

let mut intersection_iter = SortedIntersection::new(&mut iters);

assert_eq!(intersection_iter.next(), Some(&6));
assert_eq!(intersection_iter.next(), Some(&9));
assert_eq!(intersection_iter.next(), Some(&18));
assert_eq!(intersection_iter.next(), None);

About

Intersection Iterator over Sorted Iterators

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages