pub struct AdminField {
pub name: &'static str,
pub label: String,
pub kind: AdminFieldKind,
pub list_display: bool,
pub searchable: bool,
pub filterable: bool,
pub required: bool,
pub editable: bool,
pub sortable: bool,
pub encrypted: bool,
pub encrypted_visible: bool,
}Expand description
Metadata for a single model field.
Fields§
§name: &'static strColumn name in the database / struct field name.
label: StringHuman-readable label for the UI.
kind: AdminFieldKindWidget type.
list_display: boolWhether this field appears in the list view table.
searchable: boolWhether this field is searchable (included in text search).
filterable: boolWhether this field can be used as a filter.
required: boolWhether this field is required on create/edit forms.
editable: boolWhether this field is editable (false for IDs, timestamps, etc.).
sortable: boolSort priority in list view (None = not sortable).
encrypted: boolWhether this column is encrypted at rest (#805). When set, the field is
rendered as a disabled, redacted, unsubmitted control in forms (so its
plaintext is never placed into the HTML and a save never overwrites the
stored ciphertext), and — unless Self::encrypted_visible is also set —
redacted (••••••••) in list and detail views.
This is a per-field flag rather than a global column-name lookup so that an unrelated resource with a same-named plaintext field stays fully editable.
encrypted_visible: boolFor an Self::encrypted column, show its decrypted plaintext in list and
detail (read) views — the #[encrypted(admin_visible)] opt-in. Edit forms
still never pre-fill the plaintext. Has no effect unless encrypted is set.
Implementations§
Source§impl AdminField
impl AdminField
Sourcepub fn new(name: &'static str, kind: AdminFieldKind) -> Self
pub fn new(name: &'static str, kind: AdminFieldKind) -> Self
Create a new field with sensible defaults.
By default: displayed in list, not searchable, not filterable,
required, and sortable. Editable defaults to true except for
AdminFieldKind::Hidden, which is read-only by contract
(and is therefore excluded from strip_meta_fields acceptance
even if a caller later flips editable back to true).
Sourcepub const fn encrypted(self) -> Self
pub const fn encrypted(self) -> Self
Mark this column as encrypted at rest (#805): redacted in read views and rendered as a disabled, unsubmitted control in forms.
Sourcepub const fn encrypted_visible(self) -> Self
pub const fn encrypted_visible(self) -> Self
Mark this column as encrypted at rest but show its decrypted plaintext in
read views (the #[encrypted(admin_visible)] opt-in). Implies
Self::encrypted; edit forms still never pre-fill the plaintext.
Sourcepub const fn searchable(self) -> Self
pub const fn searchable(self) -> Self
Mark this field as searchable.
Sourcepub const fn filterable(self) -> Self
pub const fn filterable(self) -> Self
Mark this field as filterable.
Sourcepub const fn hide_from_list(self) -> Self
pub const fn hide_from_list(self) -> Self
Hide this field from the list view.
Trait Implementations§
Source§impl Clone for AdminField
impl Clone for AdminField
Source§fn clone(&self) -> AdminField
fn clone(&self) -> AdminField
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AdminField
impl RefUnwindSafe for AdminField
impl Send for AdminField
impl Sync for AdminField
impl Unpin for AdminField
impl UnsafeUnpin for AdminField
impl UnwindSafe for AdminField
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> RepositoryHooksClone for Twhere
T: Clone,
impl<T> RepositoryHooksClone for Twhere
T: Clone,
Source§fn autumn_clone(&self) -> T
fn autumn_clone(&self) -> T
Source§impl<T, Conn> RunQueryDsl<Conn> for T
impl<T, Conn> RunQueryDsl<Conn> for T
Source§fn execute<'conn, 'query>(
self,
conn: &'conn mut Conn,
) -> <Conn as AsyncConnectionCore>::ExecuteFuture<'conn, 'query>
fn execute<'conn, 'query>( self, conn: &'conn mut Conn, ) -> <Conn as AsyncConnectionCore>::ExecuteFuture<'conn, 'query>
Source§fn load<'query, 'conn, U>(
self,
conn: &'conn mut Conn,
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
fn load<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
Source§fn load_stream<'conn, 'query, U>(
self,
conn: &'conn mut Conn,
) -> Self::LoadFuture<'conn>where
Conn: AsyncConnectionCore,
U: 'conn,
Self: LoadQuery<'query, Conn, U> + 'query,
fn load_stream<'conn, 'query, U>(
self,
conn: &'conn mut Conn,
) -> Self::LoadFuture<'conn>where
Conn: AsyncConnectionCore,
U: 'conn,
Self: LoadQuery<'query, Conn, U> + 'query,
Stream] with the returned rows. Read moreSource§fn get_result<'query, 'conn, U>(
self,
conn: &'conn mut Conn,
) -> AndThen<Self::LoadFuture<'conn>, LoadNext<Pin<Box<Self::Stream<'conn>>>>>
fn get_result<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, LoadNext<Pin<Box<Self::Stream<'conn>>>>>
Source§fn get_results<'query, 'conn, U>(
self,
conn: &'conn mut Conn,
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
fn get_results<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
Vec with the affected rows. Read moreSource§impl<T> Scoped for T
impl<T> Scoped for T
Source§fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
ScopeQuery for this type. Resolves the
registered scope at .load() time, not here.