pub trait Data<'borrow>:
DataAccess
+ DataAccessDyn
+ Send {
// Required method
fn borrow(item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self;
}Expand description
Defines the logic to instantiate and retrieve runtime data.
§Note for API Consumers
This trait is implemented by using the Data derive.
Required Methods§
Sourcefn borrow(item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self
fn borrow(item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self
Borrows each of Self’s fields from the provided Resources.
This takes in the item_id, so that the type that implements this
trait may further filter specific data within the borrowed data, scope
to the item.
§Parameters
item_id: ID of the item this borrow is used for.resources:Anymap to borrow the data from.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.