From 9e3149b931d92208bccd34c39ccc6d5db45d498a Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 23 Mar 2022 12:46:46 +0100 Subject: [PATCH] Move ParamPtr to the prelude --- nih_plug_derive/src/params.rs | 2 +- nih_plug_egui/src/widgets/generic_ui.rs | 3 +-- nih_plug_iced/src/widgets.rs | 2 +- nih_plug_iced/src/widgets/generic_ui.rs | 3 +-- nih_plug_vizia/src/widgets.rs | 3 +-- nih_plug_vizia/src/widgets/generic_ui.rs | 3 +-- nih_plug_vizia/src/widgets/param_slider.rs | 3 +-- src/param.rs | 4 +--- src/prelude.rs | 2 +- 9 files changed, 9 insertions(+), 16 deletions(-) diff --git a/nih_plug_derive/src/params.rs b/nih_plug_derive/src/params.rs index 82233e98..2ac1657c 100644 --- a/nih_plug_derive/src/params.rs +++ b/nih_plug_derive/src/params.rs @@ -220,7 +220,7 @@ pub fn derive_params(input: TokenStream) -> TokenStream { unsafe impl #impl_generics Params for #struct_name #ty_generics #where_clause { fn param_map( self: std::pin::Pin<&Self>, - ) -> Vec<(String, nih_plug::param::internals::ParamPtr, String)> { + ) -> Vec<(String, nih_plug::prelude::ParamPtr, String)> { // This may not be in scope otherwise, used to call .as_ptr() use ::nih_plug::param::Param; diff --git a/nih_plug_egui/src/widgets/generic_ui.rs b/nih_plug_egui/src/widgets/generic_ui.rs index f4a2dfa9..005d751b 100644 --- a/nih_plug_egui/src/widgets/generic_ui.rs +++ b/nih_plug_egui/src/widgets/generic_ui.rs @@ -5,8 +5,7 @@ use std::pin::Pin; use egui::{TextStyle, Ui, Vec2}; use nih_plug::context::ParamSetter; -use nih_plug::param::internals::ParamPtr; -use nih_plug::prelude::{Param, Params}; +use nih_plug::prelude::{Param, ParamPtr, Params}; use super::ParamSlider; diff --git a/nih_plug_iced/src/widgets.rs b/nih_plug_iced/src/widgets.rs index 5b559cbb..fa52f029 100644 --- a/nih_plug_iced/src/widgets.rs +++ b/nih_plug_iced/src/widgets.rs @@ -5,7 +5,7 @@ //! None of these widgets are finalized, and their sizes or looks can change at any point. Feel free //! to copy the widgets and modify them to your personal taste. -use nih_plug::param::internals::ParamPtr; +use nih_plug::prelude::ParamPtr; pub mod generic_ui; pub mod param_slider; diff --git a/nih_plug_iced/src/widgets/generic_ui.rs b/nih_plug_iced/src/widgets/generic_ui.rs index 01778e1d..ba74fc03 100644 --- a/nih_plug_iced/src/widgets/generic_ui.rs +++ b/nih_plug_iced/src/widgets/generic_ui.rs @@ -7,8 +7,7 @@ use std::collections::HashMap; use std::marker::PhantomData; use std::pin::Pin; -use nih_plug::param::internals::ParamPtr; -use nih_plug::prelude::{Param, Params}; +use nih_plug::prelude::{Param, ParamPtr, Params}; use super::{ParamMessage, ParamSlider}; use crate::backend::Renderer; diff --git a/nih_plug_vizia/src/widgets.rs b/nih_plug_vizia/src/widgets.rs index d516cf5b..8c60ab8a 100644 --- a/nih_plug_vizia/src/widgets.rs +++ b/nih_plug_vizia/src/widgets.rs @@ -5,8 +5,7 @@ //! None of these widgets are finalized, and their sizes or looks can change at any point. Feel free //! to copy the widgets and modify them to your personal taste. -use nih_plug::param::internals::ParamPtr; -use nih_plug::prelude::{GuiContext, Param}; +use nih_plug::prelude::{GuiContext, Param, ParamPtr}; use std::sync::Arc; use vizia::{Context, Model}; diff --git a/nih_plug_vizia/src/widgets/generic_ui.rs b/nih_plug_vizia/src/widgets/generic_ui.rs index 413ca94b..0b3c0d16 100644 --- a/nih_plug_vizia/src/widgets/generic_ui.rs +++ b/nih_plug_vizia/src/widgets/generic_ui.rs @@ -2,8 +2,7 @@ use std::{ops::Deref, pin::Pin}; -use nih_plug::param::internals::ParamPtr; -use nih_plug::prelude::Params; +use nih_plug::prelude::{ParamPtr, Params}; use vizia::*; use super::{ParamSlider, ParamSliderExt, ParamSliderStyle}; diff --git a/nih_plug_vizia/src/widgets/param_slider.rs b/nih_plug_vizia/src/widgets/param_slider.rs index caab720d..c8d3c792 100644 --- a/nih_plug_vizia/src/widgets/param_slider.rs +++ b/nih_plug_vizia/src/widgets/param_slider.rs @@ -1,7 +1,6 @@ //! A slider that integrates with NIH-plug's [`Param`] types. -use nih_plug::param::internals::ParamPtr; -use nih_plug::prelude::Param; +use nih_plug::prelude::{Param, ParamPtr}; use vizia::*; use super::util::{self, ModifiersExt}; diff --git a/src/param.rs b/src/param.rs index c7ddacd7..575a0a12 100644 --- a/src/param.rs +++ b/src/param.rs @@ -1,6 +1,4 @@ -//! TODO: Document how to use the [`Param`] trait. Also mention both interfaces: direct initialization -//! + `..Default::default()`, and the builder interface. For the moment, just look at the gain -//! example. +//! TODO: Document how to use the [`Param`] trait. For now, just look at the gain example. use std::fmt::Display; diff --git a/src/prelude.rs b/src/prelude.rs index e2350b00..85ffac6d 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -14,7 +14,7 @@ pub use super::buffer::Buffer; pub use super::context::{GuiContext, ParamSetter, ProcessContext}; // This also includes the derive macro pub use super::param::enums::{Enum, EnumParam}; -pub use super::param::internals::Params; +pub use super::param::internals::{ParamPtr, Params}; pub use super::param::range::{FloatRange, IntRange}; pub use super::param::smoothing::{Smoother, SmoothingStyle}; pub use super::param::{BoolParam, FloatParam, IntParam, Param};