pub trait IntoScope<M> {
// Required method
fn into_scope(self) -> Statement<List<M>>;
}Expand description
Convert a query into a scope statement over model M.
IntoScope<M> captures “this is a query targeting model M, regardless of
cardinality.” It admits the three forms a relation accessor can produce —
Query<List<M>>, Query<Option<M>>, and Query<M> — and lowers each to a
Statement<List<M>> suitable for use as an insert scope (see
Insert::set_scope).
Compare to IntoStatement, which preserves the
query’s returning type and so distinguishes the three forms above. IntoScope
erases that distinction, since the scope of an insert only cares about which
rows the query addresses, not how many it would return on execution.
For Query<Option<M>> and Query<M> — produced by Query::first and
Query::one respectively — the single flag and the paired LIMIT 1
added by those narrowing methods are cleared, since Statement<List<M>>
would otherwise be self-contradictory (“a list that returns one row”).
Required Methods§
Sourcefn into_scope(self) -> Statement<List<M>>
fn into_scope(self) -> Statement<List<M>>
Lower self into a Statement<List<M>> for use as an insert scope.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".