TypedCreateBuilder

Trait TypedCreateBuilder 

Source
pub trait TypedCreateBuilder: Sized {
    type Output: CreateData;

    // Required method
    fn build(self) -> Self::Output;
}
Expand description

Builder for creating records with a fluent API.

This is generated per-model and provides type-safe field setters.

§Example (Generated Code)

// This is what gets generated for a User model:
pub struct UserCreateBuilder {
    data: DataBuilder,
}

impl UserCreateBuilder {
    pub fn email(self, email: impl Into<String>) -> Self { ... }
    pub fn name(self, name: impl Into<String>) -> Self { ... }
    pub fn age(self, age: i32) -> Self { ... }
    pub fn posts(self, posts: Vec<PostCreate>) -> Self { ... }
}

Required Associated Types§

Source

type Output: CreateData

The output type.

Required Methods§

Source

fn build(self) -> Self::Output

Build the create data.

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.

Implementors§