pub struct Relation<M, T> { /* private fields */ }Expand description
A foreign key of model M pointing at T, together with access to its
slot in M, so loaders can store the related object in the struct:
ⓘ
let relation = Relation::new(Book::author, |book| &mut book.author);
let books = Book::objects(&db).select_related(relation).all().await?;
books[0].author.cached(); // Some(&Author)Chain relations with then for multi-hop select_related.
Implementations§
Source§impl<M: Model, T: Model> Relation<M, T>
impl<M: Model, T: Model> Relation<M, T>
Trait Implementations§
Auto Trait Implementations§
impl<M, T> !RefUnwindSafe for Relation<M, T>
impl<M, T> !UnwindSafe for Relation<M, T>
impl<M, T> Freeze for Relation<M, T>
impl<M, T> Send for Relation<M, T>
impl<M, T> Sync for Relation<M, T>
impl<M, T> Unpin for Relation<M, T>
impl<M, T> UnsafeUnpin for Relation<M, T>
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