Struct Ecs

Source
pub struct Ecs<ST> { /* private fields */ }
Expand description

Generic entity component system container

Needs to be specified with the parametrized Store type that has struct fields for the actual components. This can be done with the Ecs! macro.

Implementations§

Source§

impl<ST: Default + Store> Ecs<ST>

Source

pub fn new() -> Ecs<ST>

Construct a new entity component system.

Source

pub fn make(&mut self) -> Entity

Create a new empty entity.

Source

pub fn remove(&mut self, e: Entity)

Remove an entity from the system and clear its components.

Source

pub fn contains(&self, e: Entity) -> bool

Return whether the system contains an entity.

Source

pub fn iter(&self) -> Iter<'_, Entity>

Iterate through all the active entities.

Trait Implementations§

Source§

impl<ST> Deref for Ecs<ST>

Source§

type Target = ST

The resulting type after dereferencing.
Source§

fn deref(&self) -> &ST

Dereferences the value.
Source§

impl<ST> DerefMut for Ecs<ST>

Source§

fn deref_mut(&mut self) -> &mut ST

Mutably dereferences the value.
Source§

impl<'de, ST> Deserialize<'de> for Ecs<ST>
where ST: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<ST> Serialize for Ecs<ST>
where ST: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<ST> Freeze for Ecs<ST>
where ST: Freeze,

§

impl<ST> RefUnwindSafe for Ecs<ST>
where ST: RefUnwindSafe,

§

impl<ST> Send for Ecs<ST>
where ST: Send,

§

impl<ST> Sync for Ecs<ST>
where ST: Sync,

§

impl<ST> Unpin for Ecs<ST>
where ST: Unpin,

§

impl<ST> UnwindSafe for Ecs<ST>
where ST: 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,