i have the error “value moved here” when i try to use a variable like this :
error[E0382]: use of moved value: `postgres_url` --> src/main.rs:257:116 | 227 | let db_local = Connection::connect(postgres_url, TlsMode::None) | ------------ value moved here ... 257 | let counter_receive_last_id2= counter_last_entry("SELECT id::bigint from astm_receive order by id desc limit 1",&postgres_url)as i32; |
and when i don’t borrow the variable (using only the string) i have this kind of error.
--> src/main.rs:237:117 | 237 | let mut counter_receive_last_id= counter_last_entry("SELECT id::bigint from astm_receive order by id desc limit 1",postgres_url)as i32; | ^^^^^^^^^^^^ expected &str, found struct `std::string::String` | = note: expected type `&str` found type `std::string::String` = help: try with `&postgres_url`
the postgres_url is formated as a String.
Any help plz ?