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
@@ -7,7 +7,7 @@ use core::{
7
7
alloc::Layout,
8
8
cell::UnsafeCell,
9
9
num::NonZeroUsize,
10
-
ops::{Bound,Range,RangeBounds},
10
+
ops::{Bound,RangeBounds},
11
11
ptr::NonNull,
12
12
};
13
13
@@ -155,38 +155,6 @@ impl BlobArray {
155
155
}
156
156
}
157
157
158
-
/// Clears the array, i.e. removing (and dropping) all of the elements.
159
-
/// Note that this method has no effect on the allocated capacity of the vector.
160
-
///
161
-
/// Note that this method will behave exactly the same as [`Vec::clear`].
162
-
///
163
-
/// # Safety
164
-
/// - For every element with index `i`, if `i` < `len`: It must be safe to call [`Self::get_unchecked_mut`] with `i`.
165
-
/// (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.)
166
-
///
167
-
/// [`Vec::clear`]: alloc::vec::Vec::clear
168
-
pubunsafefnclear(&mutself,len:usize){
169
-
#[cfg(debug_assertions)]
170
-
debug_assert!(self.capacity >= len);
171
-
ifletSome(drop) = self.drop{
172
-
// We set `self.drop` to `None` before dropping elements for unwind safety. This ensures we don't
173
-
// accidentally drop elements twice in the event of a drop impl panicking.
174
-
self.drop = None;
175
-
let size = self.item_layout.size();
176
-
for i in0..len {
177
-
// SAFETY:
178
-
// * 0 <= `i` < `len`, so `i * size` must be in bounds for the allocation.
179
-
// * `size` is a multiple of the erased type's alignment,
180
-
// so adding a multiple of `size` will preserve alignment.
181
-
// * The item is left unreachable so it can be safely promoted to an `OwningPtr`.
182
-
let item = unsafe{self.get_ptr_mut().byte_add(i * size).promote()};
183
-
// SAFETY: `item` was obtained from this `BlobArray`, so its underlying type must match `drop`.
184
-
unsafe{drop(item)};
185
-
}
186
-
self.drop = Some(drop);
187
-
}
188
-
}
189
-
190
158
/// Clears the array, i.e. removing (and dropping) all of the elements in the range.
191
159
/// Note that this method has no effect on the allocated capacity of the vector.
192
160
///
@@ -236,11 +204,11 @@ impl BlobArray {
236
204
/// # Safety
237
205
/// - `cap` and `len` are indeed the capacity and length of this [`BlobArray`]
238
206
/// - This [`BlobArray`] mustn't be used after calling this method.
0 commit comments