pub enum HasOneModel<E>where
E: EntityTrait,{
NotSet,
Set(Box<<E as EntityTrait>::ActiveModelEx>),
}Expand description
Container for belongs_to or has_one relation
Variants§
NotSet
Unspecified value, do nothing
Set(Box<<E as EntityTrait>::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>(model: AM) -> HasOneModel<E>
pub fn set<AM>(model: AM) -> HasOneModel<E>
Construct a HasOneModel::Set
Sourcepub fn take(&mut self) -> Option<<E as EntityTrait>::ActiveModelEx>
pub fn take(&mut self) -> Option<<E as EntityTrait>::ActiveModelEx>
Take ownership of this model, leaving NotSet in place
Sourcepub fn as_ref(&self) -> Option<&<E as EntityTrait>::ActiveModelEx>
pub fn as_ref(&self) -> Option<&<E as EntityTrait>::ActiveModelEx>
Get a reference, if set
Sourcepub fn as_mut(&mut self) -> Option<&mut <E as EntityTrait>::ActiveModelEx>
pub fn as_mut(&mut self) -> Option<&mut <E as EntityTrait>::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 as EntityTrait>::ActiveModelEx>
pub fn into_option(self) -> Option<<E as EntityTrait>::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 HasOneModel<E>
impl<E> Clone for HasOneModel<E>
Source§fn clone(&self) -> HasOneModel<E>
fn clone(&self) -> HasOneModel<E>
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<E> Debug for HasOneModel<E>
impl<E> Debug for HasOneModel<E>
Source§impl<E> Default for HasOneModel<E>where
E: EntityTrait,
impl<E> Default for HasOneModel<E>where
E: EntityTrait,
Source§fn default() -> HasOneModel<E>
fn default() -> HasOneModel<E>
Returns the “default value” for a type. Read more
impl<E> Eq for HasOneModel<E>
Source§impl<E> PartialEq for HasOneModel<E>
impl<E> PartialEq for HasOneModel<E>
Source§fn eq(&self, other: &HasOneModel<E>) -> bool
fn eq(&self, other: &HasOneModel<E>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<E> PartialEq<Option<<E as EntityTrait>::ActiveModelEx>> for HasOneModel<E>
impl<E> PartialEq<Option<<E as EntityTrait>::ActiveModelEx>> for HasOneModel<E>
Source§fn eq(&self, other: &Option<<E as EntityTrait>::ActiveModelEx>) -> bool
fn eq(&self, other: &Option<<E as EntityTrait>::ActiveModelEx>) -> bool
Tests for
self and other values to be equal, and is used by ==.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> UnsafeUnpin 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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