[−][src]Struct gen_indices::GenIndexEntitySet
GenIndexEntitySet This maintains the "state" for your entities. It is designed with a Mutex, so that it is rendered thread safe.
Example:
extern crate gen_indices; extern crate num; use gen_indices::*; use num::{Num, zero, one}; let gi = GenIndexEntitySet::<u64, u64>::new(); // first index let idx1 = gi.lock().unwrap().next_index(); println!("first: {:?}", idx1); // second index let idx2 = gi.lock().unwrap().next_index(); println!("first: {:?}", idx2); // delete first index and then get next index if let Err(e) = gi.lock().unwrap().delete_index(idx1) { println!("Error: {}", e); } let idx3 = gi.lock().unwrap().next_index(); println!("first: {:?}", idx3);
Implementations
impl<I: Num + AddAssign + Copy, G: Num + AddAssign + Copy> GenIndexEntitySet<I, G>
[src]
pub fn new() -> Arc<Mutex<GenIndexEntitySet<I, G>>>
[src]
Create a new GenIndexEntitySet object, wrapped with a Mutex to allow for thread safety.
pub fn next_index(&mut self) -> GenIndex<I, G>
[src]
allocate and provide a "new" index. If an old index was deleted, that index is reused, with the generation number incremented, so that references to the deleted entity are not found.
You are responsible for the corresponding maitenence in your ECS.
pub fn delete_index(&mut self, gi: GenIndex<I, G>) -> Result<(), &'static str>
[src]
Delete an entity's index. You will be responsible for the cleanup in the corresponding ECS.
Trait Implementations
impl<I: Clone + Num + AddAssign + Copy, G: Clone + Num + AddAssign + Copy> Clone for GenIndexEntitySet<I, G>
[src]
fn clone(&self) -> GenIndexEntitySet<I, G>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<I: Debug + Num + AddAssign + Copy, G: Debug + Num + AddAssign + Copy> Debug for GenIndexEntitySet<I, G>
[src]
impl<I: Hash + Num + AddAssign + Copy, G: Hash + Num + AddAssign + Copy> Hash for GenIndexEntitySet<I, G>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<I: PartialEq + Num + AddAssign + Copy, G: PartialEq + Num + AddAssign + Copy> PartialEq<GenIndexEntitySet<I, G>> for GenIndexEntitySet<I, G>
[src]
fn eq(&self, other: &GenIndexEntitySet<I, G>) -> bool
[src]
fn ne(&self, other: &GenIndexEntitySet<I, G>) -> bool
[src]
impl<I: Num + AddAssign + Copy, G: Num + AddAssign + Copy> StructuralPartialEq for GenIndexEntitySet<I, G>
[src]
Auto Trait Implementations
impl<I, G> RefUnwindSafe for GenIndexEntitySet<I, G> where
G: RefUnwindSafe,
I: RefUnwindSafe,
G: RefUnwindSafe,
I: RefUnwindSafe,
impl<I, G> Send for GenIndexEntitySet<I, G> where
G: Send,
I: Send,
G: Send,
I: Send,
impl<I, G> Sync for GenIndexEntitySet<I, G> where
G: Sync,
I: Sync,
G: Sync,
I: Sync,
impl<I, G> Unpin for GenIndexEntitySet<I, G> where
G: Unpin,
I: Unpin,
G: Unpin,
I: Unpin,
impl<I, G> UnwindSafe for GenIndexEntitySet<I, G> where
G: UnwindSafe,
I: UnwindSafe,
G: UnwindSafe,
I: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,