Skip to main content

AdminModel

Trait AdminModel 

Source
pub trait AdminModel: Model {
    const ADMIN_NAME: &'static str;
    const DISPLAY_NAME: &'static str;
    const FIELDS: &'static [AdminField];

    // Required methods
    fn field_display(&self, name: &str) -> Option<String>;
    fn from_form(form: &FormData, id: Option<i64>) -> Result<Self, Error>;

    // Provided method
    fn singular_name() -> &'static str { ... }
}

Required Associated Constants§

Source

const ADMIN_NAME: &'static str

Source

const DISPLAY_NAME: &'static str

Source

const FIELDS: &'static [AdminField]

Required Methods§

Source

fn field_display(&self, name: &str) -> Option<String>

Source

fn from_form(form: &FormData, id: Option<i64>) -> Result<Self, Error>

Provided Methods§

Source

fn singular_name() -> &'static str

Singular form of the display name. Used for labels like “New X” and “Edit X”. Defaults to [DISPLAY_NAME]; the #[derive(RustioAdmin)] macro generates a proper singular form.

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.

Implementors§