/// println!("{}", x);
/// }
///
- /// let diff: HashSet<_> = a.intersection(&b).cloned().collect();
- /// assert_eq!(diff, [2, 3].iter().cloned().collect());
+ /// let intersection: HashSet<_> = a.intersection(&b).cloned().collect();
+ /// assert_eq!(intersection, [2, 3].iter().cloned().collect());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn intersection<'a>(&'a self, other: &'a HashSet<T, S>) -> Intersection<'a, T, S> {
/// println!("{}", x);
/// }
///
- /// let diff: HashSet<_> = a.union(&b).cloned().collect();
- /// assert_eq!(diff, [1, 2, 3, 4].iter().cloned().collect());
+ /// let union: HashSet<_> = a.union(&b).cloned().collect();
+ /// assert_eq!(union, [1, 2, 3, 4].iter().cloned().collect());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn union<'a>(&'a self, other: &'a HashSet<T, S>) -> Union<'a, T, S> {
/// Clears the set, returning all elements in an iterator.
#[inline]
- #[unstable(feature = "drain",
- reason = "matches collection reform specification, waiting for dust to settle",
- issue = "27711")]
+ #[stable(feature = "drain", since = "1.6.0")]
pub fn drain(&mut self) -> Drain<T> {
fn first<A, B>((a, _): (A, B)) -> A { a }
let first: fn((T, ())) -> T = first; // coerce to fn pointer
///
/// If the set did not have a value present, `true` is returned.
///
- /// If the set did have this key present, that value is returned, and the
- /// entry is not updated. See the [module-level documentation] for more.
- ///
- /// [module-level documentation]: index.html#insert-and-complex-keys
+ /// If the set did have this key present, `false` is returned.
///
/// # Examples
///
where T: Eq + Hash,
S: HashState + Default,
{
- #[stable(feature = "rust1", since = "1.0.0")]
fn default() -> HashSet<T, S> {
HashSet::with_hash_state(Default::default())
}
}
}
+#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K> Clone for Iter<'a, K> {
fn clone(&self) -> Iter<'a, K> { Iter { iter: self.iter.clone() } }
}
fn len(&self) -> usize { self.iter.len() }
}
+#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, S> Clone for Intersection<'a, T, S> {
fn clone(&self) -> Intersection<'a, T, S> {
Intersection { iter: self.iter.clone(), ..*self }
}
}
+#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, S> Clone for Difference<'a, T, S> {
fn clone(&self) -> Difference<'a, T, S> {
Difference { iter: self.iter.clone(), ..*self }
}
}
+#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, S> Clone for SymmetricDifference<'a, T, S> {
fn clone(&self) -> SymmetricDifference<'a, T, S> {
SymmetricDifference { iter: self.iter.clone() }
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
}
+#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, S> Clone for Union<'a, T, S> {
fn clone(&self) -> Union<'a, T, S> { Union { iter: self.iter.clone() } }
}