pub struct OperatorSet<R> { /* private fields */ }
Expand description

A collection of filters for a particular type.

A OperatorSet can be created for any type which implements Filterable. Its constructor supplies a visitor to the type’s Meta type, and constructs the necessary FilterClass objects. It can be used directly to convert incoming query pairs from Django-style query URLs into appropriate Filter objects.

Implementations

Create a new OperatorSet, by obtaining the Meta record from the target type, and visiting its fields and their operators.

Create a new filter from a decomposed URL. Note that the decomposition is ambiguous, so create_filter_from_query_pair is often preferable. The ambiguity arises because there may be no operator part, and the field part may have arbitrarily many parts. Since everything is separated with double underscores there is no way without additional information to distinguish an expression with an explicit operator from an expression on a nested field with an implicit operator. Here

  • field is the field specification part of the string, including any nested fields.
  • operator is the operator specification, if any.
  • rhs is the argument part, after the = in the URL section.

Create a new filter from a fragment of query URL. The expected input is a lhs=rhs pair from a query string, with lhs and rhs given separately. The output will either be an error, or a Filter which can apply the specified to test to objects of the target type, returning either true (include) or false (exclude).

Create a new filter from a fragment of query URL. The expected input is a lhs=rhs pair from a query string, with lhs and rhs given together in a single string. The output will either be an error, or a Filter which can apply the specified to test to objects of the target type, returning either true (include) or false (exclude).

Trait Implementations

Returns the “default value” for a type. Read more

This should be called by Meta for each exposed structure field which is Operable. Here: Read more

This should be called by Meta for each exposed structure field which can be traversed, that is where the type of the field is itself a structured type, for example when modelling foreign keys. Here: Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

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

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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