oxidecomputer / async-bb8-diesel

Safe asynchronous access to Diesel and the bb8 connection manager
MIT License
12 stars 8 forks source link

Fix lifetime weirdness in AsyncSaveChangesDsl #1

Closed mattsse closed 3 years ago

mattsse commented 3 years ago

The compiler complains when calling AsyncSaveChangesDsl::save_changes_async that borrowed value does not live long enough, this indicates that the type T is in fact &User here.

This turned out to be true and is due because the postgres UpdateAndFetchResults implementation, which is used by the SaveChangesDsl requires the Changes to be Copy, and Changes would be &User in this case.

There is also the problem that the derive Identifiable implements impl<'ident> Identifiable for &'ident User