AnyVec

Trait AnyVec 

Source
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§

Source

fn as_any(&self) -> &dyn Any

Casts the trait object to &dyn Any.

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Casts the trait object to &mut dyn Any.

Source

fn swap_remove_any(&mut self, index: usize)

Performs a swap_remove on the underlying Vec, removing the element at index.

Source

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.

Source

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.

Implementations on Foreign Types§

Source§

impl<T: 'static + Send + Sync> AnyVec for Vec<T>

Source§

fn as_any(&self) -> &dyn Any

Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Source§

fn swap_remove_any(&mut self, index: usize)

Source§

unsafe fn as_bytes(&self) -> &[u8]

Source§

unsafe fn set_from_bytes(&mut self, bytes: &[u8])

Implementors§