pub struct ActixAdminModelFilter<E: EntityTrait> {
pub name: String,
pub filter_type: ActixAdminModelFilterType,
pub filter: FilterFn<E>,
pub values: Option<Vec<(String, String)>>,
pub foreign_key: Option<String>,
pub operators: Vec<ActixAdminFilterOperator>,
}Expand description
A single filter registered on an entity via ActixAdminModelFilterTrait.
The filter closure receives the current query, the user-provided
value (a plain Option<String>) and — when the filter opted into
operator selection — the operator picked in the UI.
Fields§
§name: String§filter_type: ActixAdminModelFilterType§filter: FilterFn<E>Underlying filter callback (value-only or operator-aware).
values: Option<Vec<(String, String)>>§foreign_key: Option<String>§operators: Vec<ActixAdminFilterOperator>Operators the user may pick from. When empty, no operator selector is
rendered and operator-aware filters receive None.
Implementations§
Source§impl<E: EntityTrait> ActixAdminModelFilter<E>
impl<E: EntityTrait> ActixAdminModelFilter<E>
Sourcepub fn new(
name: impl Into<String>,
filter_type: ActixAdminModelFilterType,
filter: fn(Select<E>, Option<String>) -> Select<E>,
) -> Self
pub fn new( name: impl Into<String>, filter_type: ActixAdminModelFilterType, filter: fn(Select<E>, Option<String>) -> Select<E>, ) -> Self
Build a value-only filter. The closure receives the current query plus the user-typed value; operator information is not surfaced.
Sourcepub fn with_op(
name: impl Into<String>,
filter_type: ActixAdminModelFilterType,
filter: fn(Select<E>, Option<String>, Option<ActixAdminFilterOperator>) -> Select<E>,
) -> Self
pub fn with_op( name: impl Into<String>, filter_type: ActixAdminModelFilterType, filter: fn(Select<E>, Option<String>, Option<ActixAdminFilterOperator>) -> Select<E>, ) -> Self
Build an operator-aware filter. The closure additionally receives the operator the user picked in the UI (if any).
pub fn with_operators(self, operators: Vec<ActixAdminFilterOperator>) -> Self
Sourcepub fn with_operator_filter(
self,
f: fn(Select<E>, Option<String>, Option<ActixAdminFilterOperator>) -> Select<E>,
) -> Self
pub fn with_operator_filter( self, f: fn(Select<E>, Option<String>, Option<ActixAdminFilterOperator>) -> Select<E>, ) -> Self
Replace the filter callback with an operator-aware one.
Kept for backwards compatibility — new code should use
Self::with_op directly.
pub fn with_foreign_key(self, fk: impl Into<String>) -> Self
pub fn with_values(self, values: Vec<(String, String)>) -> Self
Trait Implementations§
Source§impl<T: EntityTrait> From<ActixAdminModelFilter<T>> for ActixAdminViewModelFilter
impl<T: EntityTrait> From<ActixAdminModelFilter<T>> for ActixAdminViewModelFilter
Source§fn from(filter: ActixAdminModelFilter<T>) -> Self
fn from(filter: ActixAdminModelFilter<T>) -> Self
Auto Trait Implementations§
impl<E> Freeze for ActixAdminModelFilter<E>
impl<E> RefUnwindSafe for ActixAdminModelFilter<E>
impl<E> Send for ActixAdminModelFilter<E>
impl<E> Sync for ActixAdminModelFilter<E>
impl<E> Unpin for ActixAdminModelFilter<E>
impl<E> UnsafeUnpin for ActixAdminModelFilter<E>
impl<E> UnwindSafe for ActixAdminModelFilter<E>
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
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>
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>
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