Skip to main content

IncludeList

Struct IncludeList 

Source
pub struct IncludeList<'db, M, C, Key, NI = ()> {
    pub get: fn(&M) -> Key,
    pub set: fn(&mut M, Related<Vec<C>>),
    pub child_key: Column<C, Key>,
    pub child_key_get: fn(&C) -> Key,
    pub filter: Filter<C>,
    pub order: Vec<OrderBy<C>>,
    pub limit: Option<u64>,
    pub nested: NI,
    /* private fields */
}
Expand description

Include a one-to-many relation (parent has many children).

Fields§

§get: fn(&M) -> Key

Extract the join key from the parent.

§set: fn(&mut M, Related<Vec<C>>)

Attach the loaded children to the parent.

§child_key: Column<C, Key>

The child column that matches the parent key.

§child_key_get: fn(&C) -> Key

Extract the join key from a child row.

§filter: Filter<C>

Optional extra filter on the child rows.

§order: Vec<OrderBy<C>>

Ordering for the child rows.

§limit: Option<u64>

Optional per-child limit (take).

§nested: NI

Nested includes on the child.

Implementations§

Source§

impl<'db, M, C, Key> IncludeList<'db, M, C, Key, ()>
where M: Model, C: Model,

Source

pub const fn new( get: fn(&M) -> Key, set: fn(&mut M, Related<Vec<C>>), child_key: Column<C, Key>, child_key_get: fn(&C) -> Key, ) -> Self

Creates a new one-to-many include.

Source§

impl<'db, M, C, Key, NI> IncludeList<'db, M, C, Key, NI>
where M: Model, C: Model,

Source

pub fn filter(self, f: Filter<C>) -> Self

Adds an extra filter on the child rows.

Source

pub fn order_by(self, o: OrderBy<C>) -> Self

Adds a child ordering.

Source

pub fn take(self, n: u64) -> Self

Limits the number of children per parent.

Source

pub fn include<J: IncludeSet<C>>( self, include: J, ) -> IncludeList<'db, M, C, Key, J>

Adds a nested include on the child.

Trait Implementations§

Source§

impl<'db, M, C, Key, NI> Clone for IncludeList<'db, M, C, Key, NI>
where NI: Clone,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'db, M, C, Key, NI> Debug for IncludeList<'db, M, C, Key, NI>
where NI: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'db, M, C, Key, NI> IncludeSet<M> for IncludeList<'db, M, C, Key, NI>
where M: Model + Send + Unpin, C: Model + Clone + Send + Unpin, Key: Encodable + Eq + Hash + Clone + Send + Sync + 'static, NI: IncludeSet<C> + Sync,

Source§

fn load<'a>( &'a self, exec: &'a dyn Executor, parents: &'a mut [M], full_table: bool, ) -> BoxFuture<'a, Result<(), Error>>

Loads the related data and attaches it to parents in place. Read more

Auto Trait Implementations§

§

impl<'db, M, C, Key, NI> Freeze for IncludeList<'db, M, C, Key, NI>
where fn(&M) -> Key: Freeze, fn(&mut M, Related<Vec<C>>): Freeze, Column<C, Key>: Freeze, fn(&C) -> Key: Freeze, Filter<C>: Freeze, Vec<OrderBy<C>>: Freeze, NI: Freeze,

§

impl<'db, M, C, Key, NI> RefUnwindSafe for IncludeList<'db, M, C, Key, NI>

§

impl<'db, M, C, Key, NI> Send for IncludeList<'db, M, C, Key, NI>
where fn(&M) -> Key: Send, fn(&mut M, Related<Vec<C>>): Send, Column<C, Key>: Send, fn(&C) -> Key: Send, Filter<C>: Send, Vec<OrderBy<C>>: Send, NI: Send,

§

impl<'db, M, C, Key, NI> Sync for IncludeList<'db, M, C, Key, NI>
where fn(&M) -> Key: Sync, fn(&mut M, Related<Vec<C>>): Sync, Column<C, Key>: Sync, fn(&C) -> Key: Sync, Filter<C>: Sync, Vec<OrderBy<C>>: Sync, NI: Sync,

§

impl<'db, M, C, Key, NI> Unpin for IncludeList<'db, M, C, Key, NI>
where fn(&M) -> Key: Unpin, fn(&mut M, Related<Vec<C>>): Unpin, Column<C, Key>: Unpin, fn(&C) -> Key: Unpin, Filter<C>: Unpin, Vec<OrderBy<C>>: Unpin, NI: Unpin,

§

impl<'db, M, C, Key, NI> UnsafeUnpin for IncludeList<'db, M, C, Key, NI>

§

impl<'db, M, C, Key, NI> UnwindSafe for IncludeList<'db, M, C, Key, NI>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more