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>) -> Self
pub fn empty(near_key: impl Into<String>) -> Self
An empty result — what loading no parents gives you.
Sourcepub fn of<N: Model>(&self, near: &N) -> &[C]
pub fn of<N: Model>(&self, near: &N) -> &[C]
Every related row for near, in the order the query returned them.
Sourcepub fn one<N: Model>(&self, near: &N) -> Option<&C>
pub fn one<N: Model>(&self, near: &N) -> Option<&C>
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§
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> 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.