pub struct Relation<P> { /* private fields */ }Expand description
One relation of a parent resource’s records.
Declared by ResourceDef::relation; the related resource
must be registered on the same panel, which keys the relation by its slug:
ResourceDef::new().relation(Relation::has_many::<CommentResource>(Comment::fields().post_id()))Implementations§
Source§impl<P> Relation<P>
impl<P> Relation<P>
Sourcepub fn has_many<C>(
foreign_key: Path<C::Model, impl ForeignKey<P::PrimaryKey>>,
) -> Selfwhere
C: Resource,
pub fn has_many<C>(
foreign_key: Path<C::Model, impl ForeignKey<P::PrimaryKey>>,
) -> Selfwhere
C: Resource,
Declare a has_many child resource whose foreign_key holds the owner’s primary key, a
single column.
Relation::has_many::<CommentResource>(Comment::fields().post_id())Trait Implementations§
Auto Trait Implementations§
impl<P> !RefUnwindSafe for Relation<P>
impl<P> !UnwindSafe for Relation<P>
impl<P> Freeze for Relation<P>
impl<P> Send for Relation<P>
impl<P> Sync for Relation<P>
impl<P> Unpin for Relation<P>
impl<P> UnsafeUnpin for Relation<P>
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