Distinguish NoLibrary/NoDatabase from EmptyLibrary/EmptyDatabase #97

Merged
wojtek merged 3 commits from 95---distinguish-nolibrary/nodatabase-from-emptylibrary/emptydatabase into main 2024-01-12 20:42:37 +01:00
2 changed files with 2 additions and 2 deletions
Showing only changes of commit 4a7fafc6bd - Show all commits

View File

@ -158,7 +158,7 @@ fn main() {
let db = JsonDatabase::new(JsonDatabaseFileBackend::new(&opt.database_file_path)); let db = JsonDatabase::new(JsonDatabaseFileBackend::new(&opt.database_file_path));
let mut music_hoard = MusicHoardBuilder::new().set_database(db).build(); let mut music_hoard = MusicHoardBuilder::default().set_database(db).build();
music_hoard music_hoard
.load_from_database() .load_from_database()
.expect("failed to load database"); .expect("failed to load database");

View File

@ -85,7 +85,7 @@ fn with_database<DB: IDatabase>(opt: Opt, builder: MusicHoardBuilder<NoLibrary,
fn main() { fn main() {
let opt = Opt::from_args(); let opt = Opt::from_args();
let builder = MusicHoardBuilder::new(); let builder = MusicHoardBuilder::default();
if opt.no_database { if opt.no_database {
with_database(opt, builder.set_database(NullDatabase)); with_database(opt, builder.set_database(NullDatabase));