From the documentation on Identifiable
:
This must be implemented to use associations. Additionally, implementing this trait allows you to pass your struct to update (
update(&your_struct)
is equivalent toupdate(YourStruct::table().find(&your_struct.primary_key())
).This trait is usually implemented on a reference to a struct, not the struct itself.
So you simply need to borrow user
:
diesel::update(&user).set(...);