AddrVec

Struct AddrVec 

Source
pub(crate) struct AddrVec<A: Addr, Inst> {
    inner: Vec<Inst>,
    _phantom: PhantomData<A>,
}

Fields§

§inner: Vec<Inst>§_phantom: PhantomData<A>

Implementations§

Source§

impl<A: Addr, Inst> AddrVec<A, Inst>

Source

pub unsafe fn get(&self, addr: A) -> &Inst

Returns an instance by its address addr.

§Safety

The caller must ensure that the given address is valid in this vector.

Source

pub unsafe fn get_mut(&mut self, addr: A) -> &mut Inst

Returns a mutable reference to some instance by its address addr.

§Safety

The caller must ensure that the given address is valid in this vector.

Source

pub(crate) fn insert(&mut self, instance: Inst) -> A

Inserts a new instance into the current Store and returns its address.

This method should always be used to insert new instances, as it is the only safe way of creating addrs.

Source

pub(crate) unsafe fn get_two_mut( &mut self, addr_one: A, addr_two: A, ) -> Option<(&mut Inst, &mut Inst)>

Mutably borrows two instances by their addresses and returns those references. In the case where both given addresses are equal, None is returned instead.

§Safety

The caller must ensure that both given addresses are valid in this vector.

Trait Implementations§

Source§

impl<A: Addr, Inst> Default for AddrVec<A, Inst>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<A, Inst> Freeze for AddrVec<A, Inst>

§

impl<A, Inst> RefUnwindSafe for AddrVec<A, Inst>
where A: RefUnwindSafe, Inst: RefUnwindSafe,

§

impl<A, Inst> Send for AddrVec<A, Inst>
where A: Send, Inst: Send,

§

impl<A, Inst> Sync for AddrVec<A, Inst>
where A: Sync, Inst: Sync,

§

impl<A, Inst> Unpin for AddrVec<A, Inst>
where A: Unpin, Inst: Unpin,

§

impl<A, Inst> UnwindSafe for AddrVec<A, Inst>
where A: UnwindSafe, Inst: 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.