Struct EcsExt

Source
pub struct EcsExt<'ecs> { /* private fields */ }
Expand description

Extended Ecs with additional methods.

Implementations§

Source§

impl EcsExt<'_>

Source

pub fn step(&mut self)

Executes active systems of all groups once.

Generated commands during the execution will be completely consumed at the end of system execution.

Trait Implementations§

Source§

impl EcsEntry for EcsExt<'_>

Source§

fn add_system<T, Sys>( &mut self, desc: T, ) -> WithResult<&mut Self, SystemId, EcsError<SystemDesc<Sys>>>
where T: Into<SystemDesc<Sys>>, Sys: System,

Adds the given system. Read more
Source§

fn add_once_system<T, Req, F>( &mut self, sys: T, ) -> WithResult<&mut Self, SystemId, EcsError<SystemDesc<FnOnceSystem<Req, F>>>>
where T: Into<FnOnceSystem<Req, F>>, FnOnceSystem<Req, F>: System,

Adds the given FnOnce system. Read more
Source§

fn unregister_system( &mut self, sid: SystemId, ) -> WithResult<&mut Self, (), EcsError>

Unregisters an inactive system for the given system id. Read more
Source§

fn activate_system( &mut self, target: SystemId, at: InsertPos, live: Tick, ) -> WithResult<&mut Self, (), EcsError>

Activates a system for the given system id if it’s not active. Read more
Source§

fn inactivate_system( &mut self, sid: SystemId, ) -> WithResult<&mut Self, (), EcsError>

Inactivates a system for the given system id. Read more
Source§

fn register_entity( &mut self, desc: EntityReg, ) -> WithResult<&mut Self, EntityIndex, EcsError>

Registers an entity type from the given descriptor. Read more
Source§

fn unregister_entity<C>( &mut self, ) -> WithResult<&mut Self, Box<dyn ContainEntity>, EcsError>
where C: Components,

Unregisters an entity type. Read more
Source§

fn add_entity<E>( &mut self, ei: EntityIndex, value: E, ) -> WithResult<&mut Self, EntityId, EcsError<E>>
where E: Entity,

Adds an entity. Read more
Source§

fn remove_entity( &mut self, eid: EntityId, ) -> WithResult<&mut Self, (), EcsError>

Removes an entity. Read more
Source§

fn add_resource<T>( &mut self, desc: T, ) -> WithResult<&mut Self, ResourceIndex, EcsError<ResourceDesc>>
where T: Into<ResourceDesc>,

Adds the given resource. Read more
Source§

fn remove_resource<R>(&mut self) -> WithResult<&mut Self, Option<R>, EcsError>
where R: Resource,

Removes a resource from the given resource type. Read more
Source§

fn get_resource<R>(&self) -> Option<&R>
where R: Resource,

Retrieves shared reference to a resource for the given resource type. Read more
Source§

fn get_resource_mut<R>(&mut self) -> Option<&mut R>
where R: Resource,

Retrieves mutable reference to a resource for the given resource type. Read more
Source§

fn get_resource_index<R>(&self) -> Option<ResourceIndex>
where R: Resource,

Returns resource index for the given resource type. Read more
Source§

fn execute_commands<T>( &mut self, cmds: T, ) -> WithResult<&mut Self, (), Box<dyn Error + Send + Sync + 'static>>

Executes the given commands in order. Read more
Source§

fn execute_command<F, R>( &mut self, f: F, ) -> WithResult<&mut Self, (), Box<dyn Error + Send + Sync + 'static>>
where F: FnOnce(Commander<'_>) -> R, R: Command,

Execute the given command. Read more
Source§

fn errors(&mut self) -> Vec<Box<dyn Error + Send + Sync + 'static>>

Returns errors generated from commands or futures. Read more
Source§

fn add_systems<T, Systems>( &mut self, descs: T, ) -> WithResult<&mut Self, (), EcsError>
where T: HelpAddManySystems<Systems>,

Adds the given systems. Read more
Source§

fn add_once_systems<T, Once>( &mut self, descs: T, ) -> WithResult<&mut Self, (), EcsError>
where T: HelpAddManyOnce<Once>,

Adds the given FnOnce systems. Read more
Source§

fn register_entity_of<T>( &mut self, ) -> WithResult<&mut Self, EntityIndex, EcsError>
where T: AsEntityReg,

Registers an entity type. Read more
Source§

fn add_resources<T>(&mut self, descs: T) -> WithResult<&mut Self, (), EcsError>
where T: HelpAddManyResources,

Adds the given resources. Read more

Auto Trait Implementations§

§

impl<'ecs> Freeze for EcsExt<'ecs>

§

impl<'ecs> RefUnwindSafe for EcsExt<'ecs>

§

impl<'ecs> !Send for EcsExt<'ecs>

§

impl<'ecs> !Sync for EcsExt<'ecs>

§

impl<'ecs> Unpin for EcsExt<'ecs>

§

impl<'ecs> !UnwindSafe for EcsExt<'ecs>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.