Create core submodule separation
All checks were successful
Cargo CI / Build and Test (pull_request) Successful in 1m4s
Cargo CI / Lint (pull_request) Successful in 45s

This commit is contained in:
Wojciech Kozlowski 2024-01-21 19:25:49 +01:00
parent 4887456650
commit 680939b749
19 changed files with 21 additions and 16 deletions

View File

@ -66,7 +66,7 @@ mod tests {
use mockall::predicate; use mockall::predicate;
use crate::{musichoard::testmod::FULL_COLLECTION, Artist, ArtistId, Collection}; use crate::{core::musichoard::testmod::FULL_COLLECTION, Artist, ArtistId, Collection};
use super::*; use super::*;
use testmod::DATABASE_JSON; use testmod::DATABASE_JSON;

View File

@ -4,7 +4,7 @@
#[cfg(test)] #[cfg(test)]
use mockall::automock; use mockall::automock;
use crate::collection::track::Format; use crate::core::collection::track::Format;
use super::{Error, Field, ILibrary, Item, Query}; use super::{Error, Field, ILibrary, Item, Query};

View File

@ -5,7 +5,7 @@ use std::{collections::HashSet, fmt, num::ParseIntError, str::Utf8Error};
#[cfg(test)] #[cfg(test)]
use mockall::automock; use mockall::automock;
use crate::collection::track::Format; use crate::core::collection::track::Format;
#[cfg(feature = "library-beets")] #[cfg(feature = "library-beets")]
pub mod beets; pub mod beets;

View File

@ -1,6 +1,6 @@
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use crate::{collection::track::Format, library::Item}; use crate::{library::Item, Format};
pub static LIBRARY_ITEMS: Lazy<Vec<Item>> = Lazy::new(|| -> Vec<Item> { pub static LIBRARY_ITEMS: Lazy<Vec<Item>> = Lazy::new(|| -> Vec<Item> {
vec![ vec![

4
src/core/mod.rs Normal file
View File

@ -0,0 +1,4 @@
pub mod collection;
pub mod database;
pub mod library;
pub mod musichoard;

View File

@ -1,4 +1,4 @@
use crate::collection::{ use crate::core::collection::{
album::{Album, AlbumId}, album::{Album, AlbumId},
artist::{Artist, ArtistId, ArtistProperties, Bandcamp, MusicBrainz, MusicButler, Qobuz}, artist::{Artist, ArtistId, ArtistProperties, Bandcamp, MusicBrainz, MusicButler, Qobuz},
track::{Format, Quality, Track, TrackId}, track::{Format, Quality, Track, TrackId},

View File

@ -5,7 +5,7 @@ use super::*;
use super::testmod::{FULL_COLLECTION, LIBRARY_COLLECTION}; use super::testmod::{FULL_COLLECTION, LIBRARY_COLLECTION};
// FIXME: check all crate::* imports - are the tests where they should be? // FIXME: check all crate::* imports - are the tests where they should be?
use crate::collection::{ use crate::core::collection::{
artist::{ArtistProperties, Bandcamp, MusicBrainz, MusicButler, Qobuz}, artist::{ArtistProperties, Bandcamp, MusicBrainz, MusicButler, Qobuz},
track::Format, track::Format,
Merge, Merge,

View File

@ -1,26 +1,27 @@
//! MusicHoard - a music collection manager. //! MusicHoard - a music collection manager.
mod collection; // FIXME: make private and only provide via re-exports.
mod musichoard; pub mod core;
// FIXME: make private and fix via re-exports.
pub mod database;
pub mod library;
use std::fmt::{self, Display}; use std::fmt::{self, Display};
use collection::artist::InvalidUrlError; // FIXME: validate the re-exports.
pub use core::database;
pub use core::library;
// FIXME: validate the re-exports. // FIXME: validate the re-exports.
pub use collection::{ pub use core::collection::{
album::{Album, AlbumId}, album::{Album, AlbumId},
artist::{Artist, ArtistId, ArtistProperties, Bandcamp, MusicBrainz, MusicButler, Qobuz}, artist::{
Artist, ArtistId, ArtistProperties, Bandcamp, InvalidUrlError, MusicBrainz, MusicButler,
Qobuz,
},
track::{Format, Quality, Track, TrackId}, track::{Format, Quality, Track, TrackId},
Collection, Collection,
}; };
// FIXME: validate the re-exports // FIXME: validate the re-exports
pub use musichoard::{MusicHoard, MusicHoardBuilder, NoDatabase, NoLibrary}; pub use core::musichoard::{MusicHoard, MusicHoardBuilder, NoDatabase, NoLibrary};
// FIXME: this should be in the musichoard module. // FIXME: this should be in the musichoard module.
/// Error type for `musichoard`. /// Error type for `musichoard`.