blackbeam / rust-mysql-simple

Mysql client library implemented in rust.
Apache License 2.0
652 stars 145 forks source link

Pooled connection not mutable #332

Closed vellichor closed 2 years ago

vellichor commented 2 years ago

Using the example code:

let pool = Pool::new(url).unwrap();
let mut conn = pool.get_conn().unwrap();

and mysql = 22.2.0, where url is a well-formed &str, I get

#15 1.928 error[E0596]: cannot borrow `conn` as mutable, as it is not declared as mutable

I'm new to Rust, so please advise if I'm doing something obvious here, but I've looked all over my own code, including looking for any other definitions of conn, and haven't found anything.

blackbeam commented 2 years ago

Hi. The error must point to a particular line of your program. What's on that line?

vellichor commented 2 years ago

Apologies, it's this: let mut pooled_conn = pool.get_conn().unwrap();

vellichor commented 2 years ago

I'm actually going to close this -- signs point to me somehow resolving something other than your get_conn() as the get_conn() for this call. How, I don't know, but it doesn't look like your problem.