pub enum OptionalParent<T, Pk> {
Absent,
Template(T),
Existing(Pk),
}Expand description
An optional parent reference — the template field behind a nullable foreign key.
The default is Absent: the column stays NULL,
because a factory should never invent rows the schema does not require. A
mod opts in with an existing row or a shaped template.
Variants§
Absent
No parent; the FK column stays NULL.
Template(T)
Create the parent from this shaped template.
Existing(Pk)
Use this already-existing row’s key.
Trait Implementations§
Source§impl<T: Clone, Pk: Clone> Clone for OptionalParent<T, Pk>
impl<T: Clone, Pk: Clone> Clone for OptionalParent<T, Pk>
Source§fn clone(&self) -> OptionalParent<T, Pk>
fn clone(&self) -> OptionalParent<T, Pk>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T, Pk> Default for OptionalParent<T, Pk>
impl<T, Pk> Default for OptionalParent<T, Pk>
impl<T: PartialEq, Pk: PartialEq> StructuralPartialEq for OptionalParent<T, Pk>
Auto Trait Implementations§
impl<T, Pk> Freeze for OptionalParent<T, Pk>
impl<T, Pk> RefUnwindSafe for OptionalParent<T, Pk>where
T: RefUnwindSafe,
Pk: RefUnwindSafe,
impl<T, Pk> Send for OptionalParent<T, Pk>
impl<T, Pk> Sync for OptionalParent<T, Pk>
impl<T, Pk> Unpin for OptionalParent<T, Pk>
impl<T, Pk> UnsafeUnpin for OptionalParent<T, Pk>where
T: UnsafeUnpin,
Pk: UnsafeUnpin,
impl<T, Pk> UnwindSafe for OptionalParent<T, Pk>where
T: UnwindSafe,
Pk: 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