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§
Sourcefn has(&self, id: Uuid) -> bool
fn has(&self, id: Uuid) -> bool
Returns true, if an entity instance exists with the given UUID.
Sourcefn get(&self, id: Uuid) -> Option<ReactiveEntity>
fn get(&self, id: Uuid) -> Option<ReactiveEntity>
Returns the reactive entity instance with the given UUID or None.
Sourcefn get_by_label(&self, label: &str) -> Option<ReactiveEntity>
fn get_by_label(&self, label: &str) -> Option<ReactiveEntity>
Returns the reactive entity instance with the given label or None.
Sourcefn get_by_label_with_params(
&self,
label: &str,
) -> Option<(ReactiveEntity, HashMap<String, String>)>
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”})
Sourcefn get_by_type(&self, ty: &EntityTypeId) -> Vec<ReactiveEntity>
fn get_by_type(&self, ty: &EntityTypeId) -> Vec<ReactiveEntity>
Returns all reactive entity instances of the given type.
Sourcefn count_by_type(&self, ty: &EntityTypeId) -> usize
fn count_by_type(&self, ty: &EntityTypeId) -> usize
Returns the count of registered reactive entity instances of the given type.
Sourcefn count_by_component(&self, component: &ComponentTypeId) -> usize
fn count_by_component(&self, component: &ComponentTypeId) -> usize
Returns the count of registered reactive entity instances which are of the given component.
Sourcefn count_by_behaviour(&self, behaviour_ty: &BehaviourTypeId) -> usize
fn count_by_behaviour(&self, behaviour_ty: &BehaviourTypeId) -> usize
Returns the count of registered reactive entity instances which behaves as the given behaviour.
Sourcefn create(
&self,
entity_instance: EntityInstance,
) -> Result<ReactiveEntity, ReactiveEntityCreationError>
fn create( &self, entity_instance: EntityInstance, ) -> Result<ReactiveEntity, ReactiveEntityCreationError>
Creates a new reactive entity instance.
Sourcefn register(
&self,
reactive_entity: ReactiveEntity,
) -> Result<ReactiveEntity, ReactiveEntityRegistrationError>
fn register( &self, reactive_entity: ReactiveEntity, ) -> Result<ReactiveEntity, ReactiveEntityRegistrationError>
Registers a reactive entity instance and applies components and behaviours.
Sourcefn add_component(
&self,
id: Uuid,
component: &ComponentTypeId,
) -> Result<(), ReactiveEntityComponentAddError>
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.
Sourcefn remove_component(&self, id: Uuid, component: &ComponentTypeId)
fn remove_component(&self, id: Uuid, component: &ComponentTypeId)
Removes the component with the given name from the entity instance with the given id.