pub trait Derive: Sized + Schema {
// Required methods
fn exhaust() -> Vec<Self>;
fn inserts(&self) -> String;
// Provided method
fn derives() -> String { ... }
}Expand description
Derived table generation from enumerable domain values.
For tables whose contents can be exhaustively enumerated at runtime (e.g., street configurations, abstraction definitions), this trait generates INSERT statements programmatically.
§Usage
Implement exhaust to enumerate all valid values,
and inserts to format each as an INSERT statement.
The derives method combines these into a single
SQL batch.
§Contrast with Streamable
Use Derive for small, enumerable tables where INSERT is sufficient.
Use Streamable for large datasets requiring binary COPY performance.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.