Skip to main content

ForeignKeyRef

Trait ForeignKeyRef 

Source
pub trait ForeignKeyRef<M, T>: ColumnRef<M> { }
Expand description

A foreign key column on M pointing to T: Post::AUTHOR_ID (an author_id: ForeignKey<User> field) is a ForeignKeyRef<Post, User>, so relation methods infer the related model and reject a column that points elsewhere. &str is accepted too (then name the model with ::<T>).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<M, T> ForeignKeyRef<M, T> for &str

Implementors§

Source§

impl<M, T: Model> ForeignKeyRef<M, T> for Column<M, ForeignKey<T>>