DVec

Struct DVec 

Source
pub struct DVec<T>
where T: Deinterleave,
{ /* private fields */ }
Expand description

Store elements of type T field by field.

A deinterleaved vector stores its value by splitting its components into different arrays to maximize cache friendliness and locality. Dense arrays are used so all elements must have all the fields.

Implementations§

Source§

impl<T> DVec<T>
where T: Deinterleave,

Source

pub fn len(&self) -> usize

Number of elements.

Source

pub fn is_empty(&self) -> bool

Whether the DVec is empty.

Source

pub fn push(&mut self, elem: T)

Push an element at the end.

Source

pub fn remove(&mut self, i: usize) -> T

Remove an element.

§Complexity

O(n)

Source

pub fn swap_remove(&mut self, i: usize) -> T

Swap remove an element — that is, moving the element at the end of the of the array and decreasing the length.

**Note: this method does not preserve the order. If you need to keep the element order, use DVec::remove instead.

§Complexity

O(1)

Source

pub fn get<F>(&self, i: usize) -> Option<&F>
where T: HasField<F>,

Get element of this type in an array.

Source

pub fn get_mut<F>(&mut self, i: usize) -> Option<&mut F>
where T: HasField<F>,

Get element of this type in an array.

Source

pub fn iter_proxy(&self) -> T::Iter<'_>

Iterate over all fields at once.

You can select which fields to iterate on by dropping the iterators in the result type you don’t need.

Source

pub fn iter_mut_proxy(&mut self) -> T::IterMut<'_>

Iterate over all fields at once.

You can select which fields to iterate on by dropping the iterators in the result type you don’t need.

Trait Implementations§

Source§

impl<T> Clone for DVec<T>
where T: Deinterleave + Clone, T::Data: Clone,

Source§

fn clone(&self) -> DVec<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for DVec<T>
where T: Deinterleave + Debug, T::Data: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for DVec<T>
where T: Deinterleave,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> Hash for DVec<T>
where T: Deinterleave + Hash, T::Data: Hash,

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> PartialEq for DVec<T>

Source§

fn eq(&self, other: &DVec<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Eq for DVec<T>
where T: Deinterleave + Eq, T::Data: Eq,

Source§

impl<T> StructuralPartialEq for DVec<T>
where T: Deinterleave,

Auto Trait Implementations§

§

impl<T> Freeze for DVec<T>
where <T as Deinterleave>::Data: Freeze,

§

impl<T> RefUnwindSafe for DVec<T>

§

impl<T> Send for DVec<T>
where <T as Deinterleave>::Data: Send, T: Send,

§

impl<T> Sync for DVec<T>
where <T as Deinterleave>::Data: Sync, T: Sync,

§

impl<T> Unpin for DVec<T>
where <T as Deinterleave>::Data: Unpin, T: Unpin,

§

impl<T> UnwindSafe for DVec<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.