Data

Trait 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.

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.

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,