pub struct NestedEndpoint<T> { /* private fields */ }
Expand description

A Django nested route.

A nested route in Django is a way of specifying that a particular filter field must be present when querying for a particular object type, and that it the filter type must be exact match. So for example, if all objects of type Foo have a reference to a Bar, and its too expensive or undesirable to query for Foos without specifying which Bar they come from, then you can express this in Django as a nested route:

http://example.com/bars/my-bar-id/foos

where in order to ask any question about Foos you must first identify a particular associated Bar.

Since the django-query crate operates on query parameters, the simplest way to handle this is to use a UrlTransform to convert any relevant parts of the path into query parameters as required, which is all this type does. It is otherwise identical to Endpoint.

Implementations

Create a new NestedEndpoint.

The given UrlTransform will be applied to every incoming request. The row_source will be used to gather the data to respond to the rewritten request.

Trait Implementations

Given a reference to a Request return a ResponseTemplate that will be used by the MockServer as blueprint for the response returned to the client. 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