You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crates/bevy_ecs/src/entity/mod.rs
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1321,7 +1321,10 @@ pub type EntityIdLocation = Option<EntityLocation>;
1321
1321
/// An [`Entity`] that has been disabled. This entity will not be found by queries or accessible via other ECS operations, but it's components are still stored in the ECS.
1322
1322
/// This is useful for temporarily disabling an entity without fully despawning it or invoking archetype moves. This entity keeps track of its location, so it can be re-enabled later.
1323
1323
pubstructDisabledEntity{
1324
+
/// The disabled entity.
1324
1325
pubentity:Entity,
1326
+
/// The location of the entity after it was disabled.
1327
+
/// This may not necessarily be it's location when it is re-enabled.
Copy file name to clipboardExpand all lines: crates/bevy_ecs/src/storage/blob_array.rs
+3-35Lines changed: 3 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ use core::{
5
5
alloc::Layout,
6
6
cell::UnsafeCell,
7
7
num::NonZeroUsize,
8
-
ops::{Bound,Range,RangeBounds},
8
+
ops::{Bound,RangeBounds},
9
9
ptr::NonNull,
10
10
};
11
11
@@ -162,38 +162,6 @@ impl BlobArray {
162
162
}
163
163
}
164
164
165
-
/// Clears the array, i.e. removing (and dropping) all of the elements.
166
-
/// Note that this method has no effect on the allocated capacity of the vector.
167
-
///
168
-
/// Note that this method will behave exactly the same as [`Vec::clear`].
169
-
///
170
-
/// # Safety
171
-
/// - For every element with index `i`, if `i` < `len`: It must be safe to call [`Self::get_unchecked_mut`] with `i`.
172
-
/// (If the safety requirements of every method that has been used on `Self` have been fulfilled, the caller just needs to ensure that `len` is correct.)
173
-
///
174
-
/// [`Vec::clear`]: alloc::vec::Vec::clear
175
-
pubunsafefnclear(&mutself,len:usize){
176
-
#[cfg(debug_assertions)]
177
-
debug_assert!(self.capacity >= len);
178
-
ifletSome(drop) = self.drop{
179
-
// We set `self.drop` to `None` before dropping elements for unwind safety. This ensures we don't
180
-
// accidentally drop elements twice in the event of a drop impl panicking.
181
-
self.drop = None;
182
-
let size = self.item_layout.size();
183
-
for i in0..len {
184
-
// SAFETY:
185
-
// * 0 <= `i` < `len`, so `i * size` must be in bounds for the allocation.
186
-
// * `size` is a multiple of the erased type's alignment,
187
-
// so adding a multiple of `size` will preserve alignment.
188
-
// * The item is left unreachable so it can be safely promoted to an `OwningPtr`.
189
-
let item = unsafe{self.get_ptr_mut().byte_add(i * size).promote()};
190
-
// SAFETY: `item` was obtained from this `BlobArray`, so its underlying type must match `drop`.
191
-
unsafe{drop(item)};
192
-
}
193
-
self.drop = Some(drop);
194
-
}
195
-
}
196
-
197
165
/// Clears the array, i.e. removing (and dropping) all of the elements in the range.
198
166
/// Note that this method has no effect on the allocated capacity of the vector.
199
167
///
@@ -243,11 +211,11 @@ impl BlobArray {
243
211
/// # Safety
244
212
/// - `cap` and `len` are indeed the capacity and length of this [`BlobArray`]
245
213
/// - This [`BlobArray`] mustn't be used after calling this method.
0 commit comments