Trait django_query::filtering::OperatorClass
source · [−]pub trait OperatorClass<T> {
type Instance: Operator<T>;
fn instantiate(&self, rhs: &str) -> Result<Self::Instance, FilterError>;
}
Expand description
Something that can make an operator instance from a right-hand side.
An OperatorClass
can make a particular type of Operator,
performing any needed parsing on the right-hand side of the filter
expression. The main part of parsing a query is in identifying the
OperatorClass
that can handle the requested left hand side; once
that has been done, that object will take over via
instantiate() and construct the
particular Operator instance to use for that query.
Associated Types
Required methods
fn instantiate(&self, rhs: &str) -> Result<Self::Instance, FilterError>
fn instantiate(&self, rhs: &str) -> Result<Self::Instance, FilterError>
Create a new Operator, parsing the supplied argument string to initialise whatever representation this operator uses to match against objects. Since this is a parsing operation, it can fail.