pub enum ActiveHasOne<E>where
E: EntityTrait,{
NotSet,
Set(Option<Box<E::ActiveModelEx>>),
}Expand description
State carried by a has_one field on an
ActiveModelEx.
Unstable: nested-ActiveModel relation mutation is exempt from semver โ the
semantics of setting or removing related records may change in a minor (2.x) release.
Variantsยง
NotSet
Field is absent; the related model is left as-is on save.
Set(Option<Box<E::ActiveModelEx>>)
Set or clear the related ActiveModel on save.
Implementationsยง
Sourceยงimpl<E> ActiveHasOne<E>where
E: EntityTrait,
impl<E> ActiveHasOne<E>where
E: EntityTrait,
Sourcepub fn set(model: Option<impl Into<E::ActiveModelEx>>) -> Self
pub fn set(model: Option<impl Into<E::ActiveModelEx>>) -> Self
Construct an ActiveHasOne::Set from an optional related active model.
Sourcepub fn is_not_set(&self) -> bool
pub fn is_not_set(&self) -> bool
Return true if self is NotSet
Sourcepub fn as_ref(&self) -> Option<&E::ActiveModelEx>
pub fn as_ref(&self) -> Option<&E::ActiveModelEx>
Get a reference, if set
Sourcepub fn as_mut(&mut self) -> Option<&mut E::ActiveModelEx>
pub fn as_mut(&mut self) -> Option<&mut E::ActiveModelEx>
Get a mutable reference, if set
Sourcepub fn is_changed(&self) -> bool
pub fn is_changed(&self) -> bool
Return true if the containing model is set and changed
Sourcepub fn into_option(self) -> Option<E::ActiveModelEx>
pub fn into_option(self) -> Option<E::ActiveModelEx>
Convert into an Option<ActiveModelEx>
Sourcepub fn try_into_model(self) -> Result<HasOne<E>, DbErr>
pub fn try_into_model(self) -> Result<HasOne<E>, DbErr>
Convert this back to a ModelEx container
Trait Implementationsยง
Sourceยงimpl<E> Clone for ActiveHasOne<E>
impl<E> Clone for ActiveHasOne<E>
Sourceยงimpl<E> Debug for ActiveHasOne<E>
impl<E> Debug for ActiveHasOne<E>
Sourceยงimpl<E> Default for ActiveHasOne<E>where
E: EntityTrait,
impl<E> Default for ActiveHasOne<E>where
E: EntityTrait,
Sourceยงfn default() -> ActiveHasOne<E>
fn default() -> ActiveHasOne<E>
Returns the โdefault valueโ for a type. Read more
impl<E> Eq for ActiveHasOne<E>
Auto Trait Implementationsยง
impl<E> Freeze for ActiveHasOne<E>
impl<E> RefUnwindSafe for ActiveHasOne<E>
impl<E> Send for ActiveHasOne<E>
impl<E> Sync for ActiveHasOne<E>
impl<E> Unpin for ActiveHasOne<E>
impl<E> UnsafeUnpin for ActiveHasOne<E>
impl<E> UnwindSafe for ActiveHasOne<E>
Blanket Implementationsยง
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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