pub trait IntoInsertColumns<S: Model, T: Model> {
// Required method
fn into_insert_columns(self) -> Vec<InsertSelectColumn<S, T>>;
}Expand description
Closure-return shape for QuerySet::insert_into. The closure can
return either a single InsertSelectColumn<S, T> or a
Vec<InsertSelectColumn<S, T>> — this trait bridges both so the user
writes the natural thing at the call site.
The <S, T> parameters are the trait’s discriminator: a single
closure-return type implements IntoInsertColumns<S, T> for exactly
one (S, T) pair, so the closure’s inferred return type ties the
source and target identity into the QuerySet<S>::insert_into::<T, _, _>
receiver. Wrong-side mappings (e.g. returning
Vec<InsertSelectColumn<T, S>> where S != T) do not implement
IntoInsertColumns<S, T> and fail to compile.
Sealed-by-convention: only the two shipped impls
(InsertSelectColumn<S, T> and Vec<InsertSelectColumn<S, T>>)
exist, and there is no public trait method that a downstream impl
would add value beyond. Users do not implement this trait by hand.
Mirrors the crate::query::IntoAssignments trait pattern from the
bulk-update surface — same closure-return ergonomics, same sealed-
by-convention discipline.
Required Methods§
Sourcefn into_insert_columns(self) -> Vec<InsertSelectColumn<S, T>>
fn into_insert_columns(self) -> Vec<InsertSelectColumn<S, T>>
Flatten self into the ordered list of column mappings the
INSERT…SELECT emitter renders as
INSERT (...) SELECT ... FROM ....
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".