]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/collections/hash/set.rs
Auto merge of #36766 - nnethercote:hash-span-capacity, r=bluss
[rust.git] / src / libstd / collections / hash / set.rs
index dc2603dea03a88fd89ec831b5a574c94907b9774..e5fe3c2f7c61f55550b421fec6447181b11ef2a3 100644 (file)
 ///     println!("{:?}", x);
 /// }
 /// ```
+///
+/// HashSet with fixed list of elements can be initialized from an array:
+///
+/// ```
+/// use std::collections::HashSet;
+///
+/// fn main() {
+///     let viking_names: HashSet<&str> =
+///         [ "Einar", "Olaf", "Harald" ].iter().cloned().collect();
+///     // use the values stored in the set
+/// }
+/// ```
+
+
 #[derive(Clone)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct HashSet<T, S = RandomState> {