Trait bevy::utils::AHashExt [−]
pub trait AHashExt {
fn with_capacity(capacity: usize) -> Self;
}
Required methods
fn with_capacity(capacity: usize) -> Self
Implementations on Foreign Types
impl<K, V> AHashExt for HashMap<K, V, FixedState>
impl<K, V> AHashExt for HashMap<K, V, FixedState>
pub fn with_capacity(capacity: usize) -> HashMap<K, V, FixedState>
pub fn with_capacity(capacity: usize) -> HashMap<K, V, FixedState>
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);
pub fn with_capacity(capacity: usize) -> HashMap<K, V, RandomState>
pub fn with_capacity(capacity: usize) -> HashMap<K, V, RandomState>
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);
impl<K> AHashExt for HashSet<K, FixedState>
impl<K> AHashExt for HashSet<K, FixedState>
pub fn with_capacity(capacity: usize) -> HashSet<K, FixedState>
pub fn with_capacity(capacity: usize) -> HashSet<K, FixedState>
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);
pub fn with_capacity(capacity: usize) -> HashSet<K, RandomState>
pub fn with_capacity(capacity: usize) -> HashSet<K, RandomState>
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);