From 86db9d15bf83fa9d4560bd58e16779a2a28f56ce Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Thu, 13 Jul 2023 00:04:41 +0100 Subject: [PATCH] Don't assume agb-tracker-interop dependency --- tracker/agb-tracker-interop/src/lib.rs | 39 +++++++++----------------- tracker/agb-tracker/src/lib.rs | 7 +++-- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/tracker/agb-tracker-interop/src/lib.rs b/tracker/agb-tracker-interop/src/lib.rs index 2e4a3606..47b5bd04 100644 --- a/tracker/agb-tracker-interop/src/lib.rs +++ b/tracker/agb-tracker-interop/src/lib.rs @@ -52,14 +52,12 @@ impl<'a> quote::ToTokens for Track<'a> { tokens.append_all(quote! { { - use agb_tracker_interop::*; - - const SAMPLES: &[Sample<'static>] = &[#(#samples),*]; - const PATTERN_DATA: &[PatternSlot] = &[#(#pattern_data),*]; - const PATTERNS: &[Pattern] = &[#(#patterns),*]; + const SAMPLES: &[agb_tracker::__private::agb_tracker_interop::Sample<'static>] = &[#(#samples),*]; + const PATTERN_DATA: &[agb_tracker::__private::agb_tracker_interop::PatternSlot] = &[#(#pattern_data),*]; + const PATTERNS: &[agb_tracker::__private::agb_tracker_interop::Pattern] = &[#(#patterns),*]; const PATTERNS_TO_PLAY: &[usize] = &[#(#patterns_to_play),*]; - Track { + agb_tracker::Track { samples: SAMPLES, pattern_data: PATTERN_DATA, patterns: PATTERNS, @@ -95,13 +93,11 @@ impl<'a> quote::ToTokens for Sample<'a> { tokens.append_all(quote! { { - use agb_tracker_interop::*; - #[repr(align(4))] struct AlignmentWrapper([u8; N]); const SAMPLE_DATA: &[u8] = &AlignmentWrapper(*#samples).0; - agb_tracker_interop::Sample { data: SAMPLE_DATA, should_loop: #should_loop } + agb_tracker::__private::agb_tracker_interop::Sample { data: SAMPLE_DATA, should_loop: #should_loop } } }); } @@ -124,16 +120,11 @@ impl quote::ToTokens for PatternSlot { let panning = panning.to_raw(); tokens.append_all(quote! { - { - use agb_tracker::__private::*; - use agb::fixnum::Num; - - PatternSlot { - volume: Num::from_raw(#volume), - speed: Num::from_raw(#speed), - panning: Num::from_raw(#panning), - sample: #sample, - } + agb_tracker::__private::agb_tracker_interop::PatternSlot { + volume: agb_tracker::__private::Num::from_raw(#volume), + speed: agb_tracker::__private::Num::from_raw(#speed), + panning: agb_tracker::__private::Num::from_raw(#panning), + sample: #sample, } }); } @@ -150,13 +141,9 @@ impl quote::ToTokens for Pattern { } = self; tokens.append_all(quote! { - { - use agb_tracker_interop::*; - - Pattern { - length: #length, - start_position: #start_position, - } + agb_tracker::__private::agb_tracker_interop::Pattern { + length: #length, + start_position: #start_position, } }) } diff --git a/tracker/agb-tracker/src/lib.rs b/tracker/agb-tracker/src/lib.rs index e9d0473d..3b4c18d2 100644 --- a/tracker/agb-tracker/src/lib.rs +++ b/tracker/agb-tracker/src/lib.rs @@ -14,9 +14,12 @@ use agb::sound::mixer::{ChannelId, Mixer, SoundChannel}; #[cfg(feature = "xm")] pub use agb_xm::import_xm; -pub use agb_tracker_interop as __private; +pub mod __private { + pub use agb::fixnum::Num; + pub use agb_tracker_interop; +} -pub use __private::Track; +pub use agb_tracker_interop::Track; pub struct Tracker { track: &'static Track<'static>,