Make exports more explicit
All checks were successful
Cargo CI / Build and Test (pull_request) Successful in 1m47s
Cargo CI / Lint (pull_request) Successful in 1m14s

This commit is contained in:
Wojciech Kozlowski 2024-03-09 19:08:09 +01:00
parent a011adefaa
commit 6178a30353
18 changed files with 36 additions and 25 deletions

View File

@ -2,7 +2,7 @@ use once_cell::sync::Lazy;
use crate::core::{
collection::{album::AlbumMonth, track::TrackFormat},
library::Item,
interface::library::Item,
};
pub static LIBRARY_ITEMS: Lazy<Vec<Item>> = Lazy::new(|| -> Vec<Item> {

View File

@ -0,0 +1,2 @@
pub mod database;
pub mod library;

View File

@ -1,6 +1,5 @@
pub mod collection;
pub mod database;
pub mod library;
pub mod interface;
pub mod musichoard;
#[cfg(test)]

View File

@ -6,7 +6,10 @@ pub mod musichoard_builder;
use std::fmt::{self, Display};
use crate::core::{collection, database, library};
use crate::core::{
collection,
interface::{database, library},
};
/// Error type for `musichoard`.
#[derive(Debug, PartialEq, Eq)]

View File

@ -8,8 +8,10 @@ use crate::core::{
track::{Track, TrackId, TrackNum, TrackQuality},
Collection, MergeCollections,
},
database::IDatabase,
library::{ILibrary, Item, Query},
interface::{
database::IDatabase,
library::{ILibrary, Item, Query},
},
musichoard::Error,
};
@ -468,8 +470,10 @@ mod tests {
use crate::core::{
collection::{artist::ArtistId, musicbrainz::MusicBrainz},
database::{self, MockIDatabase},
library::{self, testmod::LIBRARY_ITEMS, MockILibrary},
interface::{
database::{self, MockIDatabase},
library::{self, testmod::LIBRARY_ITEMS, MockILibrary},
},
testmod::{FULL_COLLECTION, LIBRARY_COLLECTION},
};

View File

@ -1,7 +1,6 @@
use crate::{
core::{
database::IDatabase,
library::ILibrary,
interface::{database::IDatabase, library::ILibrary},
musichoard::musichoard::{MusicHoard, NoDatabase, NoLibrary},
},
Error,
@ -79,7 +78,7 @@ impl<LIB: ILibrary, DB: IDatabase> MusicHoardBuilder<LIB, DB> {
#[cfg(test)]
mod tests {
use crate::core::{database::NullDatabase, library::NullLibrary};
use crate::core::interface::{database::NullDatabase, library::NullLibrary};
use super::*;

View File

@ -7,7 +7,7 @@ use mockall::automock;
use crate::core::{
collection::Collection,
database::{IDatabase, LoadError, SaveError},
interface::database::{IDatabase, LoadError, SaveError},
};
use super::serde::{deserialize::DeserializeDatabase, serialize::SerializeDatabase};

View File

@ -9,7 +9,7 @@ use crate::core::{
musicbrainz::MusicBrainz,
Collection,
},
database::LoadError,
interface::database::LoadError,
};
#[derive(Debug, Deserialize)]

View File

@ -5,10 +5,7 @@ pub mod database;
pub mod library;
pub use core::collection;
// TODO: evaluate the exports and/or how to do them
pub use core::database::{IDatabase, NullDatabase};
pub use core::library::{Field, ILibrary, Item, NullLibrary, Query};
pub use core::interface;
pub use core::musichoard::{
musichoard::{MusicHoard, NoDatabase, NoLibrary},

View File

@ -8,7 +8,7 @@ use std::{
str,
};
use crate::core::library::Error;
use crate::core::interface::library::Error;
use crate::library::beets::IBeetsLibraryExecutor;
const BEET_DEFAULT: &str = "beet";

View File

@ -8,7 +8,7 @@ use mockall::automock;
use crate::core::{
collection::track::TrackFormat,
library::{Error, Field, ILibrary, Item, Query},
interface::library::{Error, Field, ILibrary, Item, Query},
};
macro_rules! list_format_separator {
@ -201,7 +201,7 @@ mod testmod;
mod tests {
use mockall::predicate;
use crate::{collection::album::AlbumMonth, core::library::testmod::LIBRARY_ITEMS};
use crate::{collection::album::AlbumMonth, core::interface::library::testmod::LIBRARY_ITEMS};
use super::*;
use testmod::LIBRARY_BEETS;

View File

@ -11,11 +11,15 @@ use structopt::StructOpt;
use musichoard::{
database::json::{backend::JsonDatabaseFileBackend, JsonDatabase},
interface::{
database::{IDatabase, NullDatabase},
library::{ILibrary, NullLibrary},
},
library::beets::{
executor::{ssh::BeetsLibrarySshExecutor, BeetsLibraryProcessExecutor},
BeetsLibrary,
},
IDatabase, ILibrary, MusicHoardBuilder, NoDatabase, NoLibrary, NullDatabase, NullLibrary,
MusicHoardBuilder, NoDatabase, NoLibrary,
};
use tui::{App, EventChannel, EventHandler, EventListener, Tui, Ui};

View File

@ -1,4 +1,7 @@
use musichoard::{collection::Collection, IDatabase, ILibrary, MusicHoard};
use musichoard::{
collection::Collection, interface::database::IDatabase, interface::library::ILibrary,
MusicHoard,
};
#[cfg(test)]
use mockall::automock;

View File

@ -6,7 +6,7 @@ use tempfile::NamedTempFile;
use musichoard::{
collection::{album::AlbumDate, artist::Artist, Collection},
database::json::{backend::JsonDatabaseFileBackend, JsonDatabase},
IDatabase,
interface::database::IDatabase,
};
use crate::testlib::COLLECTION;

View File

@ -8,8 +8,8 @@ use std::{
use once_cell::sync::Lazy;
use musichoard::{
interface::library::{Field, ILibrary, Item, Query},
library::beets::{executor::BeetsLibraryProcessExecutor, BeetsLibrary},
Field, ILibrary, Item, Query,
};
use crate::library::testmod::LIBRARY_ITEMS;

View File

@ -2,7 +2,7 @@ use once_cell::sync::Lazy;
use musichoard::{
collection::{album::AlbumMonth, track::TrackFormat},
Item,
interface::library::Item,
};
pub static LIBRARY_ITEMS: Lazy<Vec<Item>> = Lazy::new(|| -> Vec<Item> {