|
1 | 1 | use alloc::alloc::handle_alloc_error;
|
2 | 2 | use bevy_ptr::{OwningPtr, Ptr, PtrMut};
|
3 | 3 | use bevy_utils::OnDrop;
|
4 |
| -use core::{alloc::Layout, cell::UnsafeCell, num::NonZero, ptr::NonNull}; |
| 4 | +use core::{alloc::Layout, num::NonZero, ptr::NonNull}; |
5 | 5 |
|
6 | 6 | /// A flat, type-erased data storage type
|
7 | 7 | ///
|
@@ -88,12 +88,6 @@ impl BlobVec {
|
88 | 88 | self.len == 0
|
89 | 89 | }
|
90 | 90 |
|
91 |
| - /// Returns the [`Layout`] of the element type stored in the vector. |
92 |
| - #[inline] |
93 |
| - pub fn layout(&self) -> Layout { |
94 |
| - self.item_layout |
95 |
| - } |
96 |
| - |
97 | 91 | /// Reserves the minimum capacity for at least `additional` more elements to be inserted in the given `BlobVec`.
|
98 | 92 | /// After calling `reserve_exact`, capacity will be greater than or equal to `self.len() + additional`. Does nothing if
|
99 | 93 | /// the capacity is already sufficient.
|
@@ -293,22 +287,6 @@ impl BlobVec {
|
293 | 287 | unsafe { p.promote() }
|
294 | 288 | }
|
295 | 289 |
|
296 |
| - /// Removes the value at `index` and drops it. |
297 |
| - /// Does not do any bounds checking on `index`. |
298 |
| - /// The removed element is replaced by the last element of the `BlobVec`. |
299 |
| - /// |
300 |
| - /// # Safety |
301 |
| - /// It is the caller's responsibility to ensure that `index` is `< self.len()`. |
302 |
| - #[inline] |
303 |
| - pub unsafe fn swap_remove_and_drop_unchecked(&mut self, index: usize) { |
304 |
| - debug_assert!(index < self.len()); |
305 |
| - let drop = self.drop; |
306 |
| - let value = self.swap_remove_and_forget_unchecked(index); |
307 |
| - if let Some(drop) = drop { |
308 |
| - drop(value); |
309 |
| - } |
310 |
| - } |
311 |
| - |
312 | 290 | /// Returns a reference to the element at `index`, without doing bounds checking.
|
313 | 291 | ///
|
314 | 292 | /// # Safety
|
@@ -357,15 +335,6 @@ impl BlobVec {
|
357 | 335 | unsafe { PtrMut::new(self.data) }
|
358 | 336 | }
|
359 | 337 |
|
360 |
| - /// Get a reference to the entire [`BlobVec`] as if it were an array with elements of type `T` |
361 |
| - /// |
362 |
| - /// # Safety |
363 |
| - /// The type `T` must be the type of the items in this [`BlobVec`]. |
364 |
| - pub unsafe fn get_slice<T>(&self) -> &[UnsafeCell<T>] { |
365 |
| - // SAFETY: the inner data will remain valid for as long as 'self. |
366 |
| - unsafe { core::slice::from_raw_parts(self.data.as_ptr() as *const UnsafeCell<T>, self.len) } |
367 |
| - } |
368 |
| - |
369 | 338 | /// Clears the vector, removing (and dropping) all values.
|
370 | 339 | ///
|
371 | 340 | /// Note that this method has no effect on the allocated capacity of the vector.
|
|
0 commit comments