Trait peace_data::Data

source ·
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§

source

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: Any map to borrow the data from.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'borrow> Data<'borrow> for &'borrow ()

source§

fn borrow(_item_id: &'borrow ItemId, _resources: &'borrow Resources) -> Self

source§

impl<'borrow> Data<'borrow> for ()

source§

fn borrow(_item_id: &'borrow ItemId, _resources: &'borrow Resources) -> Self

Implementors§

source§

impl<'borrow, T> Data<'borrow> for RMaybe<'borrow, T>
where T: Debug + Send + Sync + 'static,

source§

impl<'borrow, T> Data<'borrow> for WMaybe<'borrow, T>
where T: Debug + Send + Sync + 'static,

source§

impl<'borrow, T> Data<'borrow> for R<'borrow, T>
where T: Debug + Send + Sync + 'static,

source§

impl<'borrow, T> Data<'borrow> for W<'borrow, T>
where T: Debug + Send + Sync + 'static,