Hi,
has anyone managed to run chapter06/building_a_database_connection_pool codebase locally? I'm stuck with compile time errors, seems connections are expected to be mutable, but at time of this repo creation it wasn't the case. I tried to change get_state to following, along with create/edit/delete rs file but with that I get trait not implemented error "the trait bound &mut DB: FromRequest is not satisfied" because its immutable DB
I'm using Rust 1.83 on ubuntu 24.
pub fn get_state(db: &mut DB) -> ToDoItems {
let connection = &mut db.connection;
//let mut connection: diesel::PgConnection = _establish_connection();
let mut array_buffer = Vec::new();
let items = to_do::table
.order_by(to_do::columns::id.asc())
.load::<Item>(connection)
.unwrap();
for item in items {
let status = TaskStatus::from_string(item.status.as_str().to_string());
let item = to_do_factory(&item.title, status);
array_buffer.push(item);
}
return ToDoItems::new(array_buffer);
}
Hi,
has anyone managed to run chapter06/building_a_database_connection_pool codebase locally? I'm stuck with compile time errors, seems connections are expected to be mutable, but at time of this repo creation it wasn't the case. I tried to change get_state to following, along with create/edit/delete rs file but with that I get trait not implemented error "the trait bound &mut DB: FromRequest is not satisfied" because its immutable DB
I'm using Rust 1.83 on ubuntu 24.