Skip to content

Commit

Permalink
force the order of the internal iterators in Iter
Browse files Browse the repository at this point in the history
  • Loading branch information
ubnt-intrepid authored and SergioBenitez committed Jan 17, 2019
1 parent 5d6c817 commit c253a23
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/jar.rs
Expand Up @@ -344,7 +344,10 @@ impl CookieJar {
/// }
/// ```
pub fn iter(&self) -> Iter {
Iter { delta_cookies: self.delta_cookies.union(&self.original_cookies) }
Iter {
delta_cookies: self.delta_cookies.iter()
.chain(self.original_cookies.difference(&self.delta_cookies)),
}
}

/// Returns a `PrivateJar` with `self` as its parent jar using the key `key`
Expand Down Expand Up @@ -439,12 +442,13 @@ impl<'a> Iterator for Delta<'a> {
}
}

use std::collections::hash_set::Union;
use std::collections::hash_set::Difference;
use std::collections::hash_map::RandomState;
use std::iter::Chain;

/// Iterator over all of the cookies in a jar.
pub struct Iter<'a> {
delta_cookies: Union<'a, DeltaCookie, RandomState>,
delta_cookies: Chain<HashSetIter<'a, DeltaCookie>, Difference<'a, DeltaCookie, RandomState>>,
}

impl<'a> Iterator for Iter<'a> {
Expand Down

0 comments on commit c253a23

Please sign in to comment.