logo

Trait bevy::utils::AHashExt[]

pub trait AHashExt {
    fn with_capacity(capacity: usize) -> Self;
}

Required methods

Implementations on Foreign Types

Creates an empty StableHashMap with the specified capacity with aHash.

The hash map will be able to hold at least capacity elements without reallocating. If capacity is 0, the hash map will not allocate.

Examples
use bevy_utils::{StableHashMap, AHashExt};
let mut map: StableHashMap<&str, i32> = StableHashMap::with_capacity(10);
assert!(map.capacity() >= 10);

Creates an empty HashMap with the specified capacity with aHash.

The hash map will be able to hold at least capacity elements without reallocating. If capacity is 0, the hash map will not allocate.

Examples
use bevy_utils::{HashMap, AHashExt};
let mut map: HashMap<&str, i32> = HashMap::with_capacity(10);
assert!(map.capacity() >= 10);

Creates an empty StableHashSet with the specified capacity with aHash.

The hash set will be able to hold at least capacity elements without reallocating. If capacity is 0, the hash set will not allocate.

Examples
use bevy_utils::{StableHashSet, AHashExt};
let set: StableHashSet<i32> = StableHashSet::with_capacity(10);
assert!(set.capacity() >= 10);

Creates an empty HashSet with the specified capacity with aHash.

The hash set will be able to hold at least capacity elements without reallocating. If capacity is 0, the hash set will not allocate.

Examples
use bevy_utils::{HashSet, AHashExt};
let set: HashSet<i32> = HashSet::with_capacity(10);
assert!(set.capacity() >= 10);

Implementors