pub struct ModelAdminConfigBuilder { /* private fields */ }Available on
server only.Expand description
Builder for ModelAdminConfig
Implementations§
Source§impl ModelAdminConfigBuilder
impl ModelAdminConfigBuilder
Sourcepub fn model_name(self, name: impl Into<String>) -> Self
pub fn model_name(self, name: impl Into<String>) -> Self
Set the model name
Sourcepub fn table_name(self, name: impl Into<String>) -> Self
pub fn table_name(self, name: impl Into<String>) -> Self
Set the database table name
If not set, defaults to the model name.
Sourcepub fn pk_field(self, field: impl Into<String>) -> Self
pub fn pk_field(self, field: impl Into<String>) -> Self
Set the primary key field name
If not set, defaults to “id”.
Sourcepub fn list_display(self, fields: Vec<impl Into<String>>) -> Self
pub fn list_display(self, fields: Vec<impl Into<String>>) -> Self
Set list display fields
Sourcepub fn list_filter(self, fields: Vec<impl Into<String>>) -> Self
pub fn list_filter(self, fields: Vec<impl Into<String>>) -> Self
Set list filter fields
Sourcepub fn search_fields(self, fields: Vec<impl Into<String>>) -> Self
pub fn search_fields(self, fields: Vec<impl Into<String>>) -> Self
Set search fields
Sourcepub fn readonly_fields(self, fields: Vec<impl Into<String>>) -> Self
pub fn readonly_fields(self, fields: Vec<impl Into<String>>) -> Self
Set readonly fields
Sourcepub fn list_per_page(self, count: usize) -> Self
pub fn list_per_page(self, count: usize) -> Self
Set items per page
Sourcepub fn allow_view(self, allow: bool) -> Self
pub fn allow_view(self, allow: bool) -> Self
Set view permission
If not set, defaults to false (deny-by-default).
Sourcepub fn allow_add(self, allow: bool) -> Self
pub fn allow_add(self, allow: bool) -> Self
Set add permission
If not set, defaults to false (deny-by-default).
Sourcepub fn allow_change(self, allow: bool) -> Self
pub fn allow_change(self, allow: bool) -> Self
Set change permission
If not set, defaults to false (deny-by-default).
Sourcepub fn allow_delete(self, allow: bool) -> Self
pub fn allow_delete(self, allow: bool) -> Self
Set delete permission
If not set, defaults to false (deny-by-default).
Sourcepub fn allow_all(self, allow: bool) -> Self
pub fn allow_all(self, allow: bool) -> Self
Set all permissions (view, add, change, delete) at once
Convenience method for granting or denying all operations.
§Examples
use reinhardt_admin::core::ModelAdminConfig;
let admin = ModelAdminConfig::builder()
.model_name("User")
.allow_all(true)
.build()
.unwrap();Sourcepub fn build(self) -> AdminResult<ModelAdminConfig>
pub fn build(self) -> AdminResult<ModelAdminConfig>
Trait Implementations§
Source§impl Debug for ModelAdminConfigBuilder
impl Debug for ModelAdminConfigBuilder
Source§impl Default for ModelAdminConfigBuilder
impl Default for ModelAdminConfigBuilder
Source§fn default() -> ModelAdminConfigBuilder
fn default() -> ModelAdminConfigBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ModelAdminConfigBuilder
impl RefUnwindSafe for ModelAdminConfigBuilder
impl Send for ModelAdminConfigBuilder
impl Sync for ModelAdminConfigBuilder
impl Unpin for ModelAdminConfigBuilder
impl UnsafeUnpin for ModelAdminConfigBuilder
impl UnwindSafe for ModelAdminConfigBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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