Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAssociations with generic types #1827
Comments
This comment has been minimized.
|
This is something we should support, but I'd like to see more discussion around what the API should be. We 100% need the lifetime declared in |
This comment has been minimized.
moulins
commented
Sep 1, 2018
Well, I was thinking "What if you want to specify constraints on your lifetimes?"; but when thinking more about it, all diesel objects you'll get back via Using
Instead, I would propose |
This comment has been minimized.
|
I think allowing elided lifetimes as the syntax makes perfect sense. |
added a commit
that referenced
this issue
Sep 12, 2018
sgrif
referenced this issue
Sep 12, 2018
Merged
Allow associations to structs with lifetime parameters #1849
sgrif
closed this
in
#1849
Sep 12, 2018
This comment has been minimized.
moulins
commented
Sep 12, 2018
|
Nice, thanks for the work! |
moulins commentedAug 23, 2018
•
edited
I have the following two tables (with the corresponding
schema!s):The
#[derive(Associations)]fail withexpected lifetime parameter, because there is no way to refer to the generic lifetime'aofFooin the#[belongs_to]. Did I overlook something which could allow me to use the derive?Of course, I can implement
BelongsTomanually, and everything seems to work:But it would be nicer if we could specify these kinds of generic lifetimes, maybe with something like:
#[belongs_to(type="for<'a> Foo<'a>")]?