Module rin::ecs::operators [−][src]
Operators are the way to access the different components in rinecs
They allow for example to select entities that contain one or more component, that optionally contain a component or that reference other entities that have a specific component.
For example Read<Position>
would select all entities that have a Position
component and give read access to said component.
Write<Position>
would do the same but give write access to that component.
One can conbine several operators using a tuple of them. For example
(Read<Position>, Write<Velocity>)
would match all entities that have a
Position
and a Velocity
component and give read access to the position
and write access to the velocity.
Entity
can be used as an operator to get access to the entity id along with
it’s components. For example (Entity, Read<Position>)
would return the entity
id for every entity that has a Position
component and give read access to that
component.
Operators are usually used through the Entities
object that a System
receives as parameter, its methods, like iter_for
,
give access to the entities’ components. These methods usually return iterators
that can be used as any other rust iterator with methods like filter, map… and
iterated over using for loops.
Modules
combined_unordered | |
filter |
Structs
Has | Operator that matches every entity that doe has this component without locking it’s storage |
HasOption | Operator that matches every entity no matter if it has the component or not but doesn’t give access to the component, only returns a boolean specifying if the component is present or not. |
HasOr | Matches entities that have any of the passed components with read only access to those components |
IterOptionWrapper | |
Not | Operator that matches every entity that doesn’t have this component |
ParStorageIter | |
Read | Operator that matches all entities that contain this component for read only access |
ReadAndParent | Operator over hierarchical components that will select an entity’s component and it’s parent for read only |
ReadAndParentRef | Operator over hierarchical components that will select an entity’s component for read only and apply another operator on it’s parent |
ReadHierarchical | |
ReadNot | Operator that matches every entity that has the first component and not the second |
ReadOption | Operator that matches every entity no matter if it has the component or not with read only access to that component |
ReadOr | Matches entities that have any of the passed components with read only access to those components |
Ref | Applies a component in another entity referenced through a component that Derefs to an Entity: |
RefData | |
RefN | |
SendSto | |
Sto | Used as a argument in storages systems, wraps the storage for an operator or query |
URef | Matches a component in another entity referenced through a component that Derefs to an Entity: |
URefData | |
Write | Operator that matches all entity’s that contain this component for read and write access |
WriteAndParent | Operator over hierarchical components that will select an entity’s component and it’s parent for read and write |
WriteHierarchical | |
WriteOption | Operator that matches every entity no matter if it has the component or not with read and write access to that component |
Enums
OperatorId |
Traits
ChangedData | |
ChangedDataSend | |
ChangedOrderedData | |
ChangedOrderedDataSend | |
ChangesData | |
ChangesDataSend | |
ChangesOrderedData | |
ChangesOrderedDataSend | |
DataAccesses | |
FromComponent | |
OptionStorage | |
OptionStorageMut | |
OrderedData | |
OrderedDataSend | |
ParOptionStorage | |
ParOptionStorageMut | |
ReadOnlyOp | |
ReadOnlyOrderedOp | |
SafeIter | Trait to implement by storages that can safely implment iterator. For example Ref and RefN can’t cause it could give simultaneous mutable access to the same entry twice |
SafeStreamingIter | Trait to implement by storages that can safely implment Streamingiterator. For example Ref and RefN can’t impl Iterator but can impl StreamingIterator |
StorageWrapper | |
TupleStorageEntities | |
UnorderedData | |
UnorderedDataSend |
Type Definitions
ReadRef |