Quantcast
Channel: How to update an existing object with Diesel? "`T: Identifiable` is not satisfied" - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Andrea Proone for How to update an existing object with Diesel? "`T: Identifiable` is not satisfied"

$
0
0

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 to update(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(...);

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>