pub struct AdminModelConfig {
pub slug: &'static str,
pub model_name: &'static str,
pub table_name: &'static str,
pub primary_key: &'static str,
pub fields: Vec<AdminUiField>,
pub searchable_fields: Vec<&'static str>,
pub primary_status_field: Option<&'static str>,
pub ensure_table_sql: Option<&'static str>,
}Expand description
Declarative description of an admin section. Cheap to clone — the registry’s factory closure clones one of these on every lookup so each request gets a fresh boxed model.
Fields§
§slug: &'static str§model_name: &'static str§table_name: &'static str§primary_key: &'static str§fields: Vec<AdminUiField>§searchable_fields: Vec<&'static str>§primary_status_field: Option<&'static str>§ensure_table_sql: Option<&'static str>Some(sql) runs an idempotent CREATE TABLE IF NOT EXISTS …
on every request; None skips auto-creation (caller owns
migrations). Mirrors the AdminUiModel::ensure_table_sql
contract directly.
Implementations§
Source§impl AdminModelConfig
impl AdminModelConfig
Sourcepub fn new(slug: &'static str, model_name: &'static str) -> Self
pub fn new(slug: &'static str, model_name: &'static str) -> Self
Start a new config with required identity fields. Defaults:
table_name = "", primary_key = "id", no fields, nothing
searchable, no status column, no ensure-table SQL. Call the
builder methods below before registration.
pub fn table(self, table_name: &'static str) -> Self
pub fn primary_key(self, primary_key: &'static str) -> Self
pub fn fields(self, fields: Vec<AdminUiField>) -> Self
pub fn searchable(self, searchable_fields: Vec<&'static str>) -> Self
pub fn status_field(self, name: &'static str) -> Self
pub fn ensure_sql(self, sql: &'static str) -> Self
Trait Implementations§
Source§impl Clone for AdminModelConfig
impl Clone for AdminModelConfig
Source§fn clone(&self) -> AdminModelConfig
fn clone(&self) -> AdminModelConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AdminModelConfig
impl RefUnwindSafe for AdminModelConfig
impl Send for AdminModelConfig
impl Sync for AdminModelConfig
impl Unpin for AdminModelConfig
impl UnsafeUnpin for AdminModelConfig
impl UnwindSafe for AdminModelConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more