Create the main binary #15
@ -1,7 +1,7 @@
|
|||||||
//! Module for storing MusicHoard data in a JSON file database.
|
//! Module for storing MusicHoard data in a JSON file database.
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::{PathBuf, Path};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use serde::de::DeserializeOwned;
|
use serde::de::DeserializeOwned;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
@ -57,7 +57,9 @@ pub struct DatabaseJsonFile {
|
|||||||
impl DatabaseJsonFile {
|
impl DatabaseJsonFile {
|
||||||
/// Create a database instance that will read/write to the provided path.
|
/// Create a database instance that will read/write to the provided path.
|
||||||
pub fn new(path: &Path) -> Self {
|
pub fn new(path: &Path) -> Self {
|
||||||
DatabaseJsonFile { path: path.to_path_buf() }
|
DatabaseJsonFile {
|
||||||
|
path: path.to_path_buf(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ impl<T: SimpleOption + Display> QueryOptionArgBeets for QueryOption<T> {
|
|||||||
Self::Exclude(value) => ("^", value),
|
Self::Exclude(value) => ("^", value),
|
||||||
Self::None => return None,
|
Self::None => return None,
|
||||||
};
|
};
|
||||||
Some(format!("{}{}{}", negate, option_name, value))
|
Some(format!("{negate}{option_name}{value}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ impl QueryOptionArgBeets for QueryOption<Vec<String>> {
|
|||||||
Self::Exclude(value) => ("^", value),
|
Self::Exclude(value) => ("^", value),
|
||||||
Self::None => return None,
|
Self::None => return None,
|
||||||
};
|
};
|
||||||
Some(format!("{}{}{}", negate, option_name, vec.join("; ")))
|
Some(format!("{negate}{option_name}{}", vec.join("; ")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! Module for interacting with the music library.
|
//! Module for interacting with the music library.
|
||||||
|
|
||||||
use std::{num::ParseIntError, str::Utf8Error, fmt};
|
use std::{fmt, num::ParseIntError, str::Utf8Error};
|
||||||
|
|
||||||
use crate::Artist;
|
use crate::Artist;
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ impl From<Utf8Error> for Error {
|
|||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{:#?}", self)
|
write!(f, "{self:#?}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
|
|
||||||
use musichoard::{database::{
|
use musichoard::{
|
||||||
json::{DatabaseJson, DatabaseJsonFile},
|
database::{
|
||||||
DatabaseRead, DatabaseWrite,
|
json::{DatabaseJson, DatabaseJsonFile},
|
||||||
}, Artist};
|
DatabaseRead, DatabaseWrite,
|
||||||
|
},
|
||||||
|
Artist,
|
||||||
|
};
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
|
|
||||||
use crate::COLLECTION;
|
use crate::COLLECTION;
|
||||||
|
Loading…
Reference in New Issue
Block a user