pub trait AdminModel:
Send
+ Sync
+ 'static {
const ADMIN_NAME: &'static str;
const DISPLAY_NAME: &'static str;
const SINGULAR_NAME: &'static str;
const FIELDS: &'static [AdminField];
// Required methods
fn display_values(&self) -> Vec<(String, String)>;
fn from_form(form: &FormData) -> Result<Self, Vec<String>>
where Self: Sized;
fn object_label(&self) -> String;
fn id(&self) -> i64;
fn values_to_update(&self) -> Vec<(&'static str, Value)>;
}Expand description
What the #[derive(RustioAdmin)] macro produces for each struct.
Required Associated Constants§
const ADMIN_NAME: &'static str
const DISPLAY_NAME: &'static str
const SINGULAR_NAME: &'static str
const FIELDS: &'static [AdminField]
Required Methods§
Sourcefn display_values(&self) -> Vec<(String, String)>
fn display_values(&self) -> Vec<(String, String)>
Render one row for the list page (column → display string).
Sourcefn from_form(form: &FormData) -> Result<Self, Vec<String>>where
Self: Sized,
fn from_form(form: &FormData) -> Result<Self, Vec<String>>where
Self: Sized,
Populate a new instance from an HTTP form. Returns a list of validation errors if anything was wrong.
Sourcefn object_label(&self) -> String
fn object_label(&self) -> String
A stable label for one instance (used on the delete confirm page).
fn id(&self) -> i64
fn values_to_update(&self) -> Vec<(&'static str, Value)>
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.