pub trait Resource:
Serialize
+ DeserializeOwned
+ Send
+ Sync
+ Clone
+ 'static {
type PrimaryKey: Display + DeserializeOwned + Send + Sync;
type DataLayer: DataLayer<Self>;
const NAME: &'static [&'static str];
const PRIMARY_KEY_GENERATED: bool;
// Required method
fn primary_key(&self) -> &Self::PrimaryKey;
}Expand description
Marker trait for a resource.
Required Associated Constants§
Sourceconst NAME: &'static [&'static str]
const NAME: &'static [&'static str]
Name with namespace of the resource. Each part of the array is a segment in the name (i.e. MyApp.Blog.Post).
Sourceconst PRIMARY_KEY_GENERATED: bool
const PRIMARY_KEY_GENERATED: bool
Wether the primary key of the resource is generated
Required Associated Types§
Sourcetype PrimaryKey: Display + DeserializeOwned + Send + Sync
type PrimaryKey: Display + DeserializeOwned + Send + Sync
Primary key type of the resource. Usually the type of the id for the resource.
Required Methods§
Sourcefn primary_key(&self) -> &Self::PrimaryKey
fn primary_key(&self) -> &Self::PrimaryKey
Mathos that returns the primary key of the resource
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.