moved getting shelf to universal function instead of whatever I was doing befoer

This commit is contained in:
2026-08-19 09:47:05 +01:00
parent 412b77851b
commit 949ff00396

View File

@@ -43,6 +43,17 @@ pub fn save_library(library: Library) -> io::Result<()> {
Ok(())
}
pub fn get_current_shelf(library: &mut Library) -> &mut Shelf {
// Rust variable nonsense (get current shelf index)
let shelves = &library.shelves;
let current_shelf = &library.current_shelf;
let shelf_index = get_shelf_index(shelves, current_shelf).unwrap_or(0);
// Get current shelf index and push the file
let current_shelf = &mut library.shelves[*&shelf_index];
return current_shelf;
}
pub fn initialize_library() -> Library {
let default_shelf: Shelf = Shelf {
id: 0,