pub struct Related<C> { /* private fields */ }Expand description
Rows loaded for a relationship, grouped by the near side’s key.
Returned by every relation’s load. Look a parent’s related rows up by
handing it the parent — the container knows which column to read.
Implementations§
Source§impl<C> Related<C>
impl<C> Related<C>
Sourcepub fn empty(near_key: impl Into<String>) -> Related<C>
pub fn empty(near_key: impl Into<String>) -> Related<C>
An empty result — what loading no parents gives you.
Sourcepub fn of<N>(&self, near: &N) -> &[C]where
N: Model,
pub fn of<N>(&self, near: &N) -> &[C]where
N: Model,
Every related row for near, in the order the query returned them.
Sourcepub fn one<N>(&self, near: &N) -> Option<&C>where
N: Model,
pub fn one<N>(&self, near: &N) -> Option<&C>where
N: Model,
The first related row for near — what a has_one or belongs_to
wants.
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for Related<C>
impl<C> RefUnwindSafe for Related<C>
impl<C> Send for Related<C>
impl<C> Sync for Related<C>
impl<C> Unpin for Related<C>
impl<C> UnsafeUnpin for Related<C>
impl<C> UnwindSafe for Related<C>
Blanket Implementations§
impl<T> Actor 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<T> Event for T
impl<T> Event for T
Source§fn event_name() -> &'static strwhere
Self: Sized,
fn event_name() -> &'static strwhere
Self: Sized,
A human-readable name, used by wildcard listeners and log output.
Always the Rust type path; see the trait docs.
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 moreCreates a shared type from an unshared type.