Skip to main content

ResourceEntry

Struct ResourceEntry 

Source
pub struct ResourceEntry {
Show 17 fields pub meta: AdminResource, pub form_builder: FormBuilder, pub edit_form_builder: Option<FormBuilder>, pub list_fn: Option<ListFn>, pub get_fn: Option<GetFn>, pub delete_fn: Option<DeleteFn>, pub update_fn: Option<UpdateFn>, pub partial_update_fn: Option<UpdateFn>, pub create_fn: Option<CreateFn>, pub count_fn: Option<CountFn>, pub filter_fn: Option<FilterFn>, pub group_actions: Vec<GroupAction>, pub m2m_loader: Option<M2mLoaderFn>, pub unique_fields: &'static [&'static str], pub own_field: Option<&'static str>, pub enum_label_fn: Option<EnumLabelFn>, pub table: Option<&'static str>,
}
Expand description

Admin registry entry: metadata + CRUD closures.

Fields§

§meta: AdminResource§form_builder: FormBuilder§edit_form_builder: Option<FormBuilder>§list_fn: Option<ListFn>§get_fn: Option<GetFn>§delete_fn: Option<DeleteFn>§update_fn: Option<UpdateFn>§partial_update_fn: Option<UpdateFn>§create_fn: Option<CreateFn>§count_fn: Option<CountFn>§filter_fn: Option<FilterFn>§group_actions: Vec<GroupAction>§m2m_loader: Option<M2mLoaderFn>§unique_fields: &'static [&'static str]§own_field: Option<&'static str>

Field name used to verify record ownership when can_update_own/can_delete_own is set. If None, “own” permissions are blocked (safe default until the field is declared).

§enum_label_fn: Option<EnumLabelFn>

Model-provided resolver turning enum db values into display labels (display views).

§table: Option<&'static str>

The table the resource’s entity reads, from the entity itself (Entity::table_name()). None for a resource that didn’t declare it.

Implementations§

Source§

impl ResourceEntry

Source

pub fn new(meta: AdminResource, form_builder: FormBuilder) -> Self

Creates a resource entry with only metadata and a form builder set; every CRUD closure defaults to None until wired up via the with_* builders.

Source

pub fn with_table(self, table: &'static str) -> Self

Declares the table the resource’s entity reads. Generated admin code passes Entity::table_name(), so it can’t drift from the model.

Source

pub fn is_account_table(&self) -> bool

Whether the resource is the accounts table (eihwaz_users) — the built-in users, or a model extending it with extend!{}. Only those may send a password reset.

Source

pub fn with_enum_label_fn(self, f: EnumLabelFn) -> Self

Registers the enum-label resolver used to turn raw enum db values into display labels in list/detail/delete views. Used by generated admin resource code; not typically called directly.

Source

pub fn with_m2m_loader(self, f: M2mLoaderFn) -> Self

Registers the closure that loads many-to-many field options for the create/edit form.

Source

pub fn with_edit_form_builder(self, f: FormBuilder) -> Self

Registers a dedicated form builder for the edit view, used instead of form_builder when the edit form differs from the create form.

Source

pub fn with_list_fn(self, f: ListFn) -> Self

Registers the closure that returns a page of resource entries for the list view.

Source

pub fn with_get_fn(self, f: GetFn) -> Self

Registers the closure that fetches a single entry by its ID.

Source

pub fn with_delete_fn(self, f: DeleteFn) -> Self

Registers the closure that deletes an entry by its ID.

Source

pub fn with_update_fn(self, f: UpdateFn) -> Self

Registers the closure that fully updates an entry from validated form data.

Source

pub fn with_partial_update_fn(self, f: UpdateFn) -> Self

Registers the closure used for partial updates (e.g. group/bulk field updates).

Source

pub fn with_create_fn(self, f: CreateFn) -> Self

Registers the closure that creates a new entry from validated form data.

Source

pub fn with_count_fn(self, f: CountFn) -> Self

Registers the closure that returns the total row count, used for pagination.

Source

pub fn with_filter_fn(self, f: FilterFn) -> Self

Registers the closure that returns the distinct values available for each list_filter sidebar column.

Source

pub fn with_unique_fields(self, fields: &'static [&'static str]) -> Self

Declares which field names carry a unique DB constraint on the underlying model. Used to exclude them from bulk edit, since applying the same value to multiple rows would violate the constraint.

Source

pub fn with_own_field(self, field: &'static str) -> Self

Declares the field used to verify record ownership when can_update_own/can_delete_own permissions are set.

Source

pub fn with_group_actions(self, actions: Vec<GroupAction>) -> Self

Registers the bulk (group) actions available in the list view, merging choices together for actions declared multiple times on the same field.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<F, T> ConvertInto<T> for F
where T: ConvertFrom<F>,

Source§

fn convert_into(self) -> T

Infallibly converts a value of type Self to a value of type T.
Source§

impl<F, T> ConvertTryFrom<F> for T
where F: ConvertInto<T>,

Source§

type Error = !

The type of an error that can occur during a conversion. Read more
Source§

fn convert_try_from(value: F) -> Result<T, !>

Fallibly converts a value of type F to a value of type Self.
Source§

impl<F, T> ConvertTryInto<T> for F
where T: ConvertTryFrom<F>,

Source§

type Error = <T as ConvertTryFrom<F>>::Error

The type of an error that can occur during a conversion. Read more
Source§

fn convert_try_into(self) -> Result<T, <T as ConvertTryFrom<F>>::Error>

Fallibly converts a value of type Self to a value of type T.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ServiceExt for T

Source§

fn compression(self) -> Compression<Self>
where Self: Sized,

Compresses response bodies. Read more
Source§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
Source§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
Source§

fn override_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request. Read more
Source§

fn append_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Append a header into the request. Read more
Source§

fn insert_request_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request, if the header is not already present. Read more
Source§

fn override_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response. Read more
Source§

fn append_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Append a header into the response. Read more
Source§

fn insert_response_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response, if the header is not already present. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more