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>
impl<A: Addr, Inst> AddrVec<A, Inst>
Sourcepub unsafe fn get(&self, addr: A) -> &Inst
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.
Sourcepub unsafe fn get_mut(&mut self, addr: A) -> &mut Inst
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.
Sourcepub(crate) fn insert(&mut self, instance: Inst) -> A
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.
Sourcepub(crate) unsafe fn get_two_mut(
&mut self,
addr_one: A,
addr_two: A,
) -> Option<(&mut Inst, &mut Inst)>
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§
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>
impl<A, Inst> Sync for AddrVec<A, Inst>
impl<A, Inst> Unpin for AddrVec<A, Inst>
impl<A, Inst> UnwindSafe for AddrVec<A, Inst>where
A: UnwindSafe,
Inst: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more