Add more from the std

This commit is contained in:
2026-03-19 10:04:21 +01:00
parent 9b8afd2c5c
commit fc3a04a20e
49 changed files with 5497 additions and 424 deletions

View File

@@ -229,6 +229,7 @@ impl<T, S> HashSet<T, S> {
/// set.insert(2);
/// ```
#[inline]
#[must_use]
#[stable(feature = "hashmap_build_hasher", since = "1.7.0")]
#[rustc_const_stable(feature = "const_collections_with_hasher", since = "1.85.0")]
pub const fn with_hasher(hasher: S) -> HashSet<T, S> {
@@ -261,6 +262,7 @@ impl<T, S> HashSet<T, S> {
/// set.insert(1);
/// ```
#[inline]
#[must_use]
#[stable(feature = "hashmap_build_hasher", since = "1.7.0")]
pub fn with_capacity_and_hasher(capacity: usize, hasher: S) -> HashSet<T, S> {
HashSet { base: base::HashSet::with_capacity_and_hasher(capacity, hasher) }
@@ -281,6 +283,7 @@ impl<T, S, A: Allocator> HashSet<T, S, A> {
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
/// the `HashSet` to be useful, see its documentation for details.
#[inline]
#[must_use]
#[unstable(feature = "allocator_api", issue = "32838")]
pub fn with_hasher_in(hasher: S, alloc: A) -> HashSet<T, S, A> {
HashSet { base: base::HashSet::with_hasher_in(hasher, alloc) }
@@ -301,6 +304,7 @@ impl<T, S, A: Allocator> HashSet<T, S, A> {
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
/// the `HashSet` to be useful, see its documentation for details.
#[inline]
#[must_use]
#[unstable(feature = "allocator_api", issue = "32838")]
pub fn with_capacity_and_hasher_in(capacity: usize, hasher: S, alloc: A) -> HashSet<T, S, A> {
HashSet { base: base::HashSet::with_capacity_and_hasher_in(capacity, hasher, alloc) }