pub struct BelongsTo<From, To, Relation = (), Key = i64> { /* private fields */ }Expand description
A typed forward foreign-key relation from one model to another.
Implementations§
Source§impl<From, To, Relation, Key> BelongsTo<From, To, Relation, Key>
impl<From, To, Relation, Key> BelongsTo<From, To, Relation, Key>
pub const fn new( table: &'static str, column: &'static str, getter: fn(&From) -> Key, alias: &'static str, related_name: &'static str, ) -> Self
pub const fn field(&self) -> ColumnRef
pub const fn alias(&self) -> &'static str
pub fn foreign_key(&self, model: &From) -> Key
pub const fn reverse(&self) -> HasMany<To, From, Relation, Key>
Trait Implementations§
Source§impl<From: Clone, To: Clone, Relation: Clone, Key: Clone> Clone for BelongsTo<From, To, Relation, Key>
impl<From: Clone, To: Clone, Relation: Clone, Key: Clone> Clone for BelongsTo<From, To, Relation, Key>
impl<From: Copy, To: Copy, Relation: Copy, Key: Copy> Copy for BelongsTo<From, To, Relation, Key>
Auto Trait Implementations§
impl<From, To, Relation, Key> Forget for BelongsTo<From, To, Relation, Key>
impl<From, To, Relation, Key> Freeze for BelongsTo<From, To, Relation, Key>
impl<From, To, Relation, Key> Move for BelongsTo<From, To, Relation, Key>
impl<From, To, Relation, Key> RefUnwindSafe for BelongsTo<From, To, Relation, Key>where
fn(&From) -> Key: RefUnwindSafe,
PhantomData<fn() -> (From, To, Relation, Key)>: RefUnwindSafe,
impl<From, To, Relation, Key> Send for BelongsTo<From, To, Relation, Key>
impl<From, To, Relation, Key> Sync for BelongsTo<From, To, Relation, Key>
impl<From, To, Relation, Key> Unpin for BelongsTo<From, To, Relation, Key>
impl<From, To, Relation, Key> UnsafeUnpin for BelongsTo<From, To, Relation, Key>
impl<From, To, Relation, Key> UnwindSafe for BelongsTo<From, To, Relation, Key>
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