pub trait Operable {
type Base;
// Required method
fn apply<O: Operator<Self::Base>>(&self, op: &O) -> bool;
}
filter
only.Expand description
A type that Django filters can work on.
Django filters are defined in terms of operators on simple values, like strings and numbers. There is additional complexity, however, because these simple specifications can also be applied to collections and nullable values.
All types that occur naturally in Django queries can be made
Operable
, but so can, for example, Vec<T>
and
Option<T>
, when the T
in question is itself
Operable
. It’s up to an Operable
implementation to decide
how to take an operator on its base type and apply it to its
contents, for example by iterating over whatever contents it has.
The implementations for Vec<T>
and Option<T>
match the default
behaviour in Django.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.