pub struct FactoryBuilder<M, F: Factory<M>> { /* private fields */ }Expand description
Fluent builder returned by Model::factory(). Mirrors Laravel’s
Post::factory()->count(50)->create().
Implementations§
Source§impl<M, F: Factory<M>> FactoryBuilder<M, F>
impl<M, F: Factory<M>> FactoryBuilder<M, F>
pub fn new() -> Self
Sourcepub fn make(self) -> Vec<M>
pub fn make(self) -> Vec<M>
Produce in-memory instances (no DB hit). Equivalent to Laravel’s ->make().
Sourcepub async fn create(self, c: &Container) -> Result<Vec<M>, Error>
pub async fn create(self, c: &Container) -> Result<Vec<M>, Error>
Produce + persist instances. Equivalent to Laravel’s ->create().
Sourcepub async fn create_one(self, c: &Container) -> Result<M, Error>
pub async fn create_one(self, c: &Container) -> Result<M, Error>
Convenience: produce exactly one persisted instance.
Trait Implementations§
Auto Trait Implementations§
impl<M, F> Freeze for FactoryBuilder<M, F>
impl<M, F> RefUnwindSafe for FactoryBuilder<M, F>where
M: RefUnwindSafe,
F: RefUnwindSafe,
impl<M, F> Send for FactoryBuilder<M, F>
impl<M, F> Sync for FactoryBuilder<M, F>
impl<M, F> Unpin for FactoryBuilder<M, F>
impl<M, F> UnsafeUnpin for FactoryBuilder<M, F>
impl<M, F> UnwindSafe for FactoryBuilder<M, F>where
M: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more