pub struct HasOne<T> { /* private fields */ }Expand description
A lazily-loaded has-one association.
HasOne<T> wraps an optional T that is populated when the association
is eagerly loaded (via include) or accessed through a generated relation
accessor. Before loading, calling get panics.
This type appears as a field on model structs for has-one relations.
Implementations§
Trait Implementations§
Source§impl<T: Relation> Load for HasOne<T>
impl<T: Relation> Load for HasOne<T>
Source§fn ty() -> Type
fn ty() -> Type
Returns the
stmt::Type that describes values of this type.Source§fn ty_relation() -> Type
fn ty_relation() -> Type
Returns the
stmt::Type used when this type appears as a relation
target. The default delegates to ty().Source§impl<T: Relation> Relation for HasOne<T>
impl<T: Relation> Relation for HasOne<T>
Source§type Query = <T as Relation>::Query
type Query = <T as Relation>::Query
The query builder type for querying this relation’s target.
Source§type ManyField<__Origin> = <T as Relation>::ManyField<__Origin>
type ManyField<__Origin> = <T as Relation>::ManyField<__Origin>
The field accessor type used when this model appears as the “many” side
of a has-many relation, parameterized by the origin model.
Source§type OneField<__Origin> = <T as Relation>::OneField<__Origin>
type OneField<__Origin> = <T as Relation>::OneField<__Origin>
The field accessor type used when this model appears as the “one” side
of a has-one relation, parameterized by the origin model.
Source§type OptionOne = <T as Relation>::OptionOne
type OptionOne = <T as Relation>::OptionOne
The optional has-one relation wrapper type. Used when the foreign key
is nullable, making the association optional.
Source§fn new_many_field<__Origin>(
path: Path<__Origin, List<Self::Model>>,
) -> Self::ManyField<__Origin>
fn new_many_field<__Origin>( path: Path<__Origin, List<Self::Model>>, ) -> Self::ManyField<__Origin>
Construct a
ManyField from a path targeting a list of the model.Source§fn nullable() -> bool
fn nullable() -> bool
Returns
true if this relation target is nullable (i.e., wrapped in
Option). The default is false.Source§fn new_create() -> Self::Create
fn new_create() -> Self::Create
Return a fresh, default-initialized create builder.
Auto Trait Implementations§
impl<T> Freeze for HasOne<T>
impl<T> RefUnwindSafe for HasOne<T>where
T: RefUnwindSafe,
impl<T> Send for HasOne<T>where
T: Send,
impl<T> Sync for HasOne<T>where
T: Sync,
impl<T> Unpin for HasOne<T>
impl<T> UnsafeUnpin for HasOne<T>
impl<T> UnwindSafe for HasOne<T>where
T: 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