pub trait ModelType {
const APP_LABEL: &'static str;
const MODEL_NAME: &'static str;
}Available on crate feature
database and non-WebAssembly only.Expand description
Trait for models that can be registered as content types
Implement this trait for each model in your application. The compiler will ensure that only valid model types can be used.
§Example
use reinhardt_db::contenttypes::ModelType;
pub struct UserModel;
impl ModelType for UserModel {
const APP_LABEL: &'static str = "auth";
const MODEL_NAME: &'static str = "User";
}Required Associated Constants§
Sourceconst MODEL_NAME: &'static str
const MODEL_NAME: &'static str
The model name
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.