Trait EntityInstanceManager

Source
pub trait EntityInstanceManager: Send + Sync {
Show 16 methods // Required methods fn has(&self, id: Uuid) -> bool; fn get(&self, id: Uuid) -> Option<ReactiveEntity>; fn get_by_label(&self, label: &str) -> Option<ReactiveEntity>; fn get_by_label_with_params( &self, label: &str, ) -> Option<(ReactiveEntity, HashMap<String, String>)>; fn get_all(&self) -> Vec<ReactiveEntity>; fn get_by_type(&self, ty: &EntityTypeId) -> Vec<ReactiveEntity>; fn get_ids(&self) -> Vec<Uuid>; fn count(&self) -> usize; fn count_by_type(&self, ty: &EntityTypeId) -> usize; fn count_by_component(&self, component: &ComponentTypeId) -> usize; fn count_by_behaviour(&self, behaviour_ty: &BehaviourTypeId) -> usize; fn create( &self, entity_instance: EntityInstance, ) -> Result<ReactiveEntity, ReactiveEntityCreationError>; fn register( &self, reactive_entity: ReactiveEntity, ) -> Result<ReactiveEntity, ReactiveEntityRegistrationError>; fn add_component( &self, id: Uuid, component: &ComponentTypeId, ) -> Result<(), ReactiveEntityComponentAddError>; fn remove_component(&self, id: Uuid, component: &ComponentTypeId); fn delete(&self, id: Uuid) -> bool;
}

Required Methods§

Source

fn has(&self, id: Uuid) -> bool

Returns true, if an entity instance exists with the given UUID.

Source

fn get(&self, id: Uuid) -> Option<ReactiveEntity>

Returns the reactive entity instance with the given UUID or None.

Source

fn get_by_label(&self, label: &str) -> Option<ReactiveEntity>

Returns the reactive entity instance with the given label or None.

Source

fn get_by_label_with_params( &self, label: &str, ) -> Option<(ReactiveEntity, HashMap<String, String>)>

Returns the reactive entity instance and the matched path parameters that matches the given label or None. /io/reactive-graph/local/users/:user_id /io/reactive-graph/local/users/PeterPenacka returns: (instance, {“user_id”: “PeterPenacka”})

Source

fn get_all(&self) -> Vec<ReactiveEntity>

Returns all reactive entity instances.

Source

fn get_by_type(&self, ty: &EntityTypeId) -> Vec<ReactiveEntity>

Returns all reactive entity instances of the given type.

Source

fn get_ids(&self) -> Vec<Uuid>

Returns all ids.

Source

fn count(&self) -> usize

Returns the count of registered reactive entity instances.

Source

fn count_by_type(&self, ty: &EntityTypeId) -> usize

Returns the count of registered reactive entity instances of the given type.

Source

fn count_by_component(&self, component: &ComponentTypeId) -> usize

Returns the count of registered reactive entity instances which are of the given component.

Source

fn count_by_behaviour(&self, behaviour_ty: &BehaviourTypeId) -> usize

Returns the count of registered reactive entity instances which behaves as the given behaviour.

Source

fn create( &self, entity_instance: EntityInstance, ) -> Result<ReactiveEntity, ReactiveEntityCreationError>

Creates a new reactive entity instance.

Source

fn register( &self, reactive_entity: ReactiveEntity, ) -> Result<ReactiveEntity, ReactiveEntityRegistrationError>

Registers a reactive entity instance and applies components and behaviours.

Source

fn add_component( &self, id: Uuid, component: &ComponentTypeId, ) -> Result<(), ReactiveEntityComponentAddError>

Adds the component with the given name to the entity instance with the given id.

Source

fn remove_component(&self, id: Uuid, component: &ComponentTypeId)

Removes the component with the given name from the entity instance with the given id.

Source

fn delete(&self, id: Uuid) -> bool

Deletes the reactive entity instance with the given id.

Implementors§