pub trait AnyVec:
Any
+ Send
+ Sync {
// Required methods
fn as_any(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;
fn swap_remove_any(&mut self, index: usize);
unsafe fn as_bytes(&self) -> &[u8] ⓘ;
unsafe fn set_from_bytes(&mut self, bytes: &[u8]);
}Expand description
An internal helper trait to perform vector operations on a type-erased Box<dyn Any>.
This allows us to call methods like swap_remove on component columns without
needing to know their concrete Vec<T> type at compile time.
Required Methods§
Sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Casts the trait object to &mut dyn Any.
Sourcefn swap_remove_any(&mut self, index: usize)
fn swap_remove_any(&mut self, index: usize)
Performs a swap_remove on the underlying Vec, removing the element at index.
Sourceunsafe fn as_bytes(&self) -> &[u8] ⓘ
unsafe fn as_bytes(&self) -> &[u8] ⓘ
§Safety
Returns the raw byte slice of the underlying Vec<T>.
The caller must ensure that this byte representation is handled correctly.
Sourceunsafe fn set_from_bytes(&mut self, bytes: &[u8])
unsafe fn set_from_bytes(&mut self, bytes: &[u8])
§Safety
Replaces the contents of the Vec<T> with the given raw bytes.
The caller must guarantee that the bytes represent a valid sequence of T
with the correct size and alignment.