pub trait CmsAdmin:
CmsAdminOverrides
+ Sized
+ Send
+ Sync
+ 'static {
// Required methods
fn admin_meta() -> &'static CmsAdminMeta;
fn admin_new() -> Self;
fn admin_id(&self) -> Option<i64>;
fn admin_title(&self) -> String;
fn admin_cell(&self, field: &str) -> String;
fn admin_widgets(&self) -> Vec<Widget>;
fn admin_apply(
&mut self,
form: &AdminForm,
skip: &[&str],
) -> Vec<FieldError>;
fn admin_list<'life0, 'life1, 'async_trait>(
pool: &'life0 Pool,
search: &'life1 str,
limit: i64,
offset: i64,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Self>, i64), ExecError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn admin_get<'life0, 'async_trait>(
pool: &'life0 Pool,
id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<Self>, ExecError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn admin_save<'life0, 'life1, 'async_trait>(
&'life0 mut self,
pool: &'life1 Pool,
) -> Pin<Box<dyn Future<Output = Result<(), ExecError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn admin_delete<'life0, 'async_trait>(
self,
pool: &'life0 Pool,
) -> Pin<Box<dyn Future<Output = Result<(), ExecError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
What #[derive(CmsAdmin)] implements. Host code rarely calls these
directly; CmsAdminPage does.
Required Methods§
Sourcefn admin_meta() -> &'static CmsAdminMeta
fn admin_meta() -> &'static CmsAdminMeta
The editor’s static description.
Sourcefn admin_title(&self) -> String
fn admin_title(&self) -> String
How a record names itself in headings and messages.
Sourcefn admin_cell(&self, field: &str) -> String
fn admin_cell(&self, field: &str) -> String
The text for list column field.
Sourcefn admin_widgets(&self) -> Vec<Widget>
fn admin_widgets(&self) -> Vec<Widget>
One widget per #[field], filled from self.
Sourcefn admin_apply(&mut self, form: &AdminForm, skip: &[&str]) -> Vec<FieldError>
fn admin_apply(&mut self, form: &AdminForm, skip: &[&str]) -> Vec<FieldError>
Copy the posted values into self, leaving the fields in skip
alone. Returns a message for each value that does not parse and
each required field left empty.
Sourcefn admin_list<'life0, 'life1, 'async_trait>(
pool: &'life0 Pool,
search: &'life1 str,
limit: i64,
offset: i64,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Self>, i64), ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn admin_list<'life0, 'life1, 'async_trait>(
pool: &'life0 Pool,
search: &'life1 str,
limit: i64,
offset: i64,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Self>, i64), ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
One page of records matching search, and the total match count.
Sourcefn admin_get<'life0, 'async_trait>(
pool: &'life0 Pool,
id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<Self>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn admin_get<'life0, 'async_trait>(
pool: &'life0 Pool,
id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<Self>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The record with primary key id.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".