pub enum HasOneModel<E: EntityTrait> {
NotSet,
Set(Box<E::ActiveModelEx>),
}Expand description
Container for belongs_to or has_one relation
Variantsยง
NotSet
Unspecified value, do nothing
Set(Box<E::ActiveModelEx>)
Specify the value for the has one relation
Implementationsยง
Sourceยงimpl<E> HasOneModel<E>where
E: EntityTrait,
impl<E> HasOneModel<E>where
E: EntityTrait,
Sourcepub fn set<AM: Into<E::ActiveModelEx>>(model: AM) -> Self
pub fn set<AM: Into<E::ActiveModelEx>>(model: AM) -> Self
Construct a HasOneModel::Set
Sourcepub fn replace<AM: Into<E::ActiveModelEx>>(&mut self, model: AM)
pub fn replace<AM: Into<E::ActiveModelEx>>(&mut self, model: AM)
Replace the inner Model
Sourcepub fn take(&mut self) -> Option<E::ActiveModelEx>
pub fn take(&mut self) -> Option<E::ActiveModelEx>
Take ownership of this model, leaving NotSet in place
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_not_set(&self) -> bool
pub fn is_not_set(&self) -> bool
Return true if self is NotSet
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 + EntityTrait> Clone for HasOneModel<E>where
E::ActiveModelEx: Clone,
impl<E: Clone + EntityTrait> Clone for HasOneModel<E>where
E::ActiveModelEx: Clone,
Sourceยงfn clone(&self) -> HasOneModel<E>
fn clone(&self) -> HasOneModel<E>
Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSourceยงimpl<E: Debug + EntityTrait> Debug for HasOneModel<E>where
E::ActiveModelEx: Debug,
impl<E: Debug + EntityTrait> Debug for HasOneModel<E>where
E::ActiveModelEx: Debug,
Sourceยงimpl<E: EntityTrait> Default for HasOneModel<E>
impl<E: EntityTrait> Default for HasOneModel<E>
Sourceยงfn default() -> HasOneModel<E>
fn default() -> HasOneModel<E>
Returns the โdefault valueโ for a type. Read more
Sourceยงimpl<E> PartialEq<Option<<E as EntityTrait>::ActiveModelEx>> for HasOneModel<E>
impl<E> PartialEq<Option<<E as EntityTrait>::ActiveModelEx>> for HasOneModel<E>
Sourceยงimpl<E> PartialEq for HasOneModel<E>
impl<E> PartialEq for HasOneModel<E>
impl<E> Eq for HasOneModel<E>
Auto Trait Implementationsยง
impl<E> Freeze for HasOneModel<E>
impl<E> RefUnwindSafe for HasOneModel<E>
impl<E> Send for HasOneModel<E>
impl<E> Sync for HasOneModel<E>
impl<E> Unpin for HasOneModel<E>
impl<E> UnwindSafe for HasOneModel<E>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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