#[non_exhaustive]pub enum ActiveHasMany<E>where
E: EntityTrait,{
NotSet,
Replace(Vec<<E as EntityTrait>::ActiveModelEx>),
Append(Vec<<E as EntityTrait>::ActiveModelEx>),
}Expand description
State carried by a has_many (or many-to-many) field on an
ActiveModelEx. Chooses between
“leave alone”, “additive write”, and “destructive replace” semantics.
Unstable: nested-ActiveModel relation mutation is exempt from semver — the
semantics of replacing or removing related records may change in a minor (2.x) release.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotSet
Field is absent; existing related models are left as-is on save.
Replace(Vec<<E as EntityTrait>::ActiveModelEx>)
Persist exactly this list of related models, deleting any existing children that are not in the list.
Append(Vec<<E as EntityTrait>::ActiveModelEx>)
Persist these related models alongside any existing children; never deletes.
Implementations§
Source§impl<E> ActiveHasMany<E>where
E: EntityTrait,
impl<E> ActiveHasMany<E>where
E: EntityTrait,
Sourcepub fn take(&mut self) -> ActiveHasMany<E>
pub fn take(&mut self) -> ActiveHasMany<E>
Take ownership of the models, leaving NotSet in place
Sourcepub fn as_slice(&self) -> &[<E as EntityTrait>::ActiveModelEx]
pub fn as_slice(&self) -> &[<E as EntityTrait>::ActiveModelEx]
Borrow models as slice
Sourcepub fn as_mut_vec(&mut self) -> &mut Vec<<E as EntityTrait>::ActiveModelEx>
pub fn as_mut_vec(&mut self) -> &mut Vec<<E as EntityTrait>::ActiveModelEx>
Get a mutable vec. If self is NotSet, convert to append.
Sourcepub fn into_vec(self) -> Vec<<E as EntityTrait>::ActiveModelEx>
pub fn into_vec(self) -> Vec<<E as EntityTrait>::ActiveModelEx>
Consume self as vector
Sourcepub fn empty_holder(&self) -> ActiveHasMany<E>
pub fn empty_holder(&self) -> ActiveHasMany<E>
Returns an empty container of self
Sourcepub fn push<AM>(&mut self, model: AM) -> &mut ActiveHasMany<E>
pub fn push<AM>(&mut self, model: AM) -> &mut ActiveHasMany<E>
Push an item to self
Sourcepub fn append<AM>(&mut self, model: AM) -> &mut ActiveHasMany<E>
pub fn append<AM>(&mut self, model: AM) -> &mut ActiveHasMany<E>
Push an item to self, but convert Replace to Append
Sourcepub fn replace_all<I>(&mut self, models: I) -> &mut ActiveHasMany<E>
pub fn replace_all<I>(&mut self, models: I) -> &mut ActiveHasMany<E>
Replace all items in this set
Sourcepub fn convert_to_append(&mut self) -> &mut ActiveHasMany<E>
pub fn convert_to_append(&mut self) -> &mut ActiveHasMany<E>
Convert self to Append, if set
Sourcepub fn is_replace(&self) -> bool
pub fn is_replace(&self) -> bool
If self is Replace
Sourcepub fn is_changed(&self) -> bool
pub fn is_changed(&self) -> bool
Return true if self is Replace or any containing model is changed
Sourcepub fn find(&self, model: &<E as EntityTrait>::Model) -> bool
pub fn find(&self, model: &<E as EntityTrait>::Model) -> bool
Find within the models by primary key, return true if found
Sourcepub fn try_into_model(self) -> Result<HasMany<E>, DbErr>
pub fn try_into_model(self) -> Result<HasMany<E>, DbErr>
Convert this back to a ModelEx container
Trait Implementations§
Source§impl<E> Clone for ActiveHasMany<E>
impl<E> Clone for ActiveHasMany<E>
Source§fn clone(&self) -> ActiveHasMany<E>
fn clone(&self) -> ActiveHasMany<E>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<E> Debug for ActiveHasMany<E>
impl<E> Debug for ActiveHasMany<E>
Source§impl<E> Default for ActiveHasMany<E>where
E: EntityTrait,
impl<E> Default for ActiveHasMany<E>where
E: EntityTrait,
Source§fn default() -> ActiveHasMany<E>
fn default() -> ActiveHasMany<E>
impl<E> Eq for ActiveHasMany<E>
Source§impl<E> From<ActiveHasMany<E>> for Option<Vec<<E as EntityTrait>::ActiveModelEx>>where
E: EntityTrait,
impl<E> From<ActiveHasMany<E>> for Option<Vec<<E as EntityTrait>::ActiveModelEx>>where
E: EntityTrait,
Source§fn from(
value: ActiveHasMany<E>,
) -> Option<Vec<<E as EntityTrait>::ActiveModelEx>>
fn from( value: ActiveHasMany<E>, ) -> Option<Vec<<E as EntityTrait>::ActiveModelEx>>
Source§impl<E> From<Vec<<E as EntityTrait>::ActiveModelEx>> for ActiveHasMany<E>where
E: EntityTrait,
Converts from a set of models into Append, which performs non-destructive action
impl<E> From<Vec<<E as EntityTrait>::ActiveModelEx>> for ActiveHasMany<E>where
E: EntityTrait,
Converts from a set of models into Append, which performs non-destructive action
Source§fn from(value: Vec<<E as EntityTrait>::ActiveModelEx>) -> ActiveHasMany<E>
fn from(value: Vec<<E as EntityTrait>::ActiveModelEx>) -> ActiveHasMany<E>
Source§impl<E> Index<usize> for ActiveHasMany<E>where
E: EntityTrait,
impl<E> Index<usize> for ActiveHasMany<E>where
E: EntityTrait,
Source§type Output = <E as EntityTrait>::ActiveModelEx
type Output = <E as EntityTrait>::ActiveModelEx
Source§impl<E> IndexMut<usize> for ActiveHasMany<E>where
E: EntityTrait,
impl<E> IndexMut<usize> for ActiveHasMany<E>where
E: EntityTrait,
Source§impl<E> IntoIterator for ActiveHasMany<E>where
E: EntityTrait,
impl<E> IntoIterator for ActiveHasMany<E>where
E: EntityTrait,
Source§type Item = <E as EntityTrait>::ActiveModelEx
type Item = <E as EntityTrait>::ActiveModelEx
Source§type IntoIter = IntoIter<<E as EntityTrait>::ActiveModelEx>
type IntoIter = IntoIter<<E as EntityTrait>::ActiveModelEx>
Source§fn into_iter(self) -> <ActiveHasMany<E> as IntoIterator>::IntoIter
fn into_iter(self) -> <ActiveHasMany<E> as IntoIterator>::IntoIter
Source§impl<E> PartialEq for ActiveHasMany<E>
impl<E> PartialEq for ActiveHasMany<E>
Auto Trait Implementations§
impl<E> Freeze for ActiveHasMany<E>
impl<E> RefUnwindSafe for ActiveHasMany<E>
impl<E> Send for ActiveHasMany<E>
impl<E> Sync for ActiveHasMany<E>
impl<E> Unpin for ActiveHasMany<E>
impl<E> UnsafeUnpin for ActiveHasMany<E>
impl<E> UnwindSafe for ActiveHasMany<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
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<F, T> ConvertInto<T> for Fwhere
T: ConvertFrom<F>,
impl<F, T> ConvertInto<T> for Fwhere
T: ConvertFrom<F>,
Source§fn convert_into(self) -> T
fn convert_into(self) -> T
Self to a value of type T.Source§impl<F, T> ConvertTryFrom<F> for Twhere
F: ConvertInto<T>,
impl<F, T> ConvertTryFrom<F> for Twhere
F: ConvertInto<T>,
Source§impl<F, T> ConvertTryInto<T> for Fwhere
T: ConvertTryFrom<F>,
impl<F, T> ConvertTryInto<T> for Fwhere
T: ConvertTryFrom<F>,
Source§type Error = <T as ConvertTryFrom<F>>::Error
type Error = <T as ConvertTryFrom<F>>::Error
Source§fn convert_try_into(self) -> Result<T, <T as ConvertTryFrom<F>>::Error>
fn convert_try_into(self) -> Result<T, <T as ConvertTryFrom<F>>::Error>
Self to a value of type T.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
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> 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> ⓘ
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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().