the problems seems to be a mutability issue; as your example code seems incomplete. you don't share the part of the code where the actual error happens:
src/diesel.rs:512:18 | 512 | ... .execute(&mut conn)
.execute(&mut conn)
requires a mutable reference to conn
. And POOL.get()
returns a non-mutable reference. You need a mutable reference to conn
.
here how to get mutable-reference to underlying data in a OnceLock https://stackoverflow.com/a/76695396/29977423