pub trait KeyedDataMarker: DataMarker {
const KEY: DataKey;
// Provided method
fn bind<P>(provider: P) -> DataProviderWithKey<Self, P>
where P: DataProvider<Self>,
Self: Sized { ... }
}
Expand description
A DataMarker
with a DataKey
attached.
Structs implementing this trait are normally generated with the data_struct!
macro.
Implementing this trait enables this marker to be used with the main DataProvider
trait.
Most markers should be associated with a specific key and should therefore implement this
trait.
BufferMarker
and AnyMarker
are examples of markers that do not implement this trait
because they are not specific to a single key.
Note: KeyedDataMarker
s are quasi-const-generic compile-time objects, and as such are expected
to be unit structs. As this is not something that can be enforced by the type system, we
currently only have a 'static
bound on them (which is needed by a lot of our code).
Required Associated Constants§
Provided Methods§
Sourcefn bind<P>(provider: P) -> DataProviderWithKey<Self, P>where
P: DataProvider<Self>,
Self: Sized,
fn bind<P>(provider: P) -> DataProviderWithKey<Self, P>where
P: DataProvider<Self>,
Self: Sized,
Binds this KeyedDataMarker
to a provider supporting it.
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.