Module rafx_base::resource_map [−][src]
Allows placing resources (i.e. "global" data) in a dictionary and looking it up by type. The data could be "global" systems, component storages, component factories, etc.
This implements a type system for expressing read/write dependencies. Many readers and single writers are allowed, but not both at the same time. This is checked at runtime, not compile time.
Lots of inspiration taken from shred
for how to create a type system
to express read/write dependencies
Structs
Read | This type represents requesting read access to T. If T is not registered, trying to fill this request will be fatal |
ReadBorrow | Represents a filled read-only request for T |
ResourceId | Every type can be converted to a |
ResourceMap | A key-value structure. The key is a type, and the value is a single object of that type |
ResourceMapBuilder | Builder for creating a ResourceMap |
Write | This type represents requesting write access to T. If T is not registered, trying to fill this request will be fatal |
WriteBorrow | Represents a filled read/write request for T |
Traits
DataBorrow | Borrow base trait. This base trait is required to allow inductively composing tuples of ReadBorrow/WriteBorrow i.e. (), (A), (A, B), (A, B, ...) inductively |
DataRequirement | DataRequirement base trait, which underlies Read |
Resource | Any data that can be stored in the ResourceMap must implement this trait. There is a blanket implementation provided for all compatible types |
Type Definitions
ReadOption | Same as |
WriteOption | Same as |