Struct VecBackedSet

Source
pub struct VecBackedSet<T: Eq> { /* private fields */ }
Expand description

Structure that exists only to have an “exists” method but backed by a vec. Backing it by a vec offers two distinct benefits:

  • We can access elements by index. Really useful for passing around cheap handles.
  • We are guaranteed an order AND a memory layout. Useful for passing to shaders.

Implementations§

Source§

impl<T: Eq> VecBackedSet<T>

Source

pub fn new() -> Self

Source

pub fn with_capacity(capacity: usize) -> Self

Source

pub fn insert(&mut self, elem: T) -> usize

Insert an element, return the index. Returns the index of the stored element.

Source

pub fn get(&self, index: usize) -> Option<&T>

Source

pub fn contains(&self, elem: &T) -> bool

Source

pub fn clear(&mut self)

Source

pub fn len(&self) -> usize

Trait Implementations§

Source§

impl<T: Debug + Eq> Debug for VecBackedSet<T>

Source§

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

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

impl<'a, T: Eq> Into<&'a Vec<T>> for &'a VecBackedSet<T>

Source§

fn into(self) -> &'a Vec<T>

Converts this type into the (usually inferred) input type.
Source§

impl<'a, T: Eq> Into<&'a mut Vec<T>> for &'a mut VecBackedSet<T>

Source§

fn into(self) -> &'a mut Vec<T>

Converts this type into the (usually inferred) input type.
Source§

impl<T: PartialEq + Eq> PartialEq for VecBackedSet<T>

Source§

fn eq(&self, other: &VecBackedSet<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 + Eq> Eq for VecBackedSet<T>

Source§

impl<T: Eq> StructuralPartialEq for VecBackedSet<T>

Auto Trait Implementations§

§

impl<T> Freeze for VecBackedSet<T>

§

impl<T> RefUnwindSafe for VecBackedSet<T>
where T: RefUnwindSafe,

§

impl<T> Send for VecBackedSet<T>
where T: Send,

§

impl<T> Sync for VecBackedSet<T>
where T: Sync,

§

impl<T> Unpin for VecBackedSet<T>
where T: Unpin,

§

impl<T> UnwindSafe for VecBackedSet<T>
where T: UnwindSafe,

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

impl<T> Type for T
where T: 'static,