File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
crates/bevy_ecs/src/storage Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -119,9 +119,18 @@ impl BlobVec {
119
119
}
120
120
}
121
121
122
+ /// Reserves the minimum capacity for at least `additional` more elements to be inserted in the given `BlobVec`.
123
+ #[ inline]
124
+ pub fn reserve ( & mut self , additional : usize ) {
125
+ if self . capacity - self . len < additional {
126
+ self . do_reserve ( additional) ;
127
+ }
128
+ }
129
+
122
130
/// Similar to `reserve_exact`. This method ensures that the capacity will grow at least `self.capacity()` if there is no
123
131
/// enough space to hold `additional` more elements.
124
- pub fn reserve ( & mut self , additional : usize ) {
132
+ #[ cold]
133
+ fn do_reserve ( & mut self , additional : usize ) {
125
134
let available_space = self . capacity - self . len ;
126
135
if available_space < additional && self . item_layout . size ( ) > 0 {
127
136
let increment = self . capacity . max ( additional - available_space) ;
You can’t perform that action at this time.
0 commit comments