From f469bbbbe6d21f1bd3ceea25ca89e90051b0dcbc Mon Sep 17 00:00:00 2001 From: Micah Johnston Date: Sun, 14 Jan 2024 21:40:06 -0600 Subject: [PATCH] rename `param` module to `params` --- coupler-derive/src/lib.rs | 20 ++++++++++---------- examples/gain/src/lib.rs | 2 +- src/format/clap/instance.rs | 2 +- src/lib.rs | 4 ++-- src/{param.rs => params.rs} | 0 src/util.rs | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) rename src/{param.rs => params.rs} (100%) diff --git a/coupler-derive/src/lib.rs b/coupler-derive/src/lib.rs index 4fb105e..9e826c0 100644 --- a/coupler-derive/src/lib.rs +++ b/coupler-derive/src/lib.rs @@ -177,7 +177,7 @@ pub fn derive_params(input: TokenStream) -> TokenStream { range.to_token_stream() } else { let ty = ¶m.ty; - quote! { <#ty as ::coupler::param::DefaultRange>::default_range() } + quote! { <#ty as ::coupler::params::DefaultRange>::default_range() } } }) .collect(); @@ -193,7 +193,7 @@ pub fn derive_params(input: TokenStream) -> TokenStream { LitStr::new(¶m.ident.to_string(), param.ident.span()) }; - let encode = quote! { ::coupler::param::Range::<#ty>::encode(&(#range), __value) }; + let encode = quote! { ::coupler::params::Range::<#ty>::encode(&(#range), __value) }; let parse = if let Some(parse) = ¶m.parse { quote! { match (#parse)(__str) { @@ -210,7 +210,7 @@ pub fn derive_params(input: TokenStream) -> TokenStream { } }; - let decode = quote! { ::coupler::param::Range::<#ty>::decode(&(#range), __value) }; + let decode = quote! { ::coupler::params::Range::<#ty>::decode(&(#range), __value) }; let display = if let Some(display) = ¶m.display { quote! { (#display)(#decode, __formatter) } } else if let Some(format) = ¶m.format { @@ -220,11 +220,11 @@ pub fn derive_params(input: TokenStream) -> TokenStream { }; quote! { - ::coupler::param::ParamInfo { + ::coupler::params::ParamInfo { id: #id, name: ::std::string::ToString::to_string(#name), - default: ::coupler::param::Range::<#ty>::encode(&(#range), __default.#ident), - steps: ::coupler::param::Range::<#ty>::steps(&(#range)), + default: ::coupler::params::Range::<#ty>::encode(&(#range), __default.#ident), + steps: ::coupler::params::Range::<#ty>::steps(&(#range)), parse: ::std::boxed::Box::new(|__str| #parse), display: ::std::boxed::Box::new(|__value, __formatter| #display), } @@ -238,7 +238,7 @@ pub fn derive_params(input: TokenStream) -> TokenStream { quote! { #id => { - self.#ident = ::coupler::param::Range::<#ty>::decode(&(#range), __value); + self.#ident = ::coupler::params::Range::<#ty>::decode(&(#range), __value); } } }); @@ -250,14 +250,14 @@ pub fn derive_params(input: TokenStream) -> TokenStream { quote! { #id => { - ::coupler::param::Range::<#ty>::encode(&(#range), self.#ident) + ::coupler::params::Range::<#ty>::encode(&(#range), self.#ident) } } }); let expanded = quote! { - impl #impl_generics ::coupler::param::Params for #ident #ty_generics #where_clause { - fn params() -> ::std::vec::Vec<::coupler::param::ParamInfo> { + impl #impl_generics ::coupler::params::Params for #ident #ty_generics #where_clause { + fn params() -> ::std::vec::Vec<::coupler::params::ParamInfo> { let __default: #ident #ty_generics = ::std::default::Default::default(); ::std::vec![ diff --git a/examples/gain/src/lib.rs b/examples/gain/src/lib.rs index a5e5f54..b3583a5 100644 --- a/examples/gain/src/lib.rs +++ b/examples/gain/src/lib.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use coupler::format::clap::*; use coupler::format::vst3::*; -use coupler::{buffers::*, bus::*, events::*, param::*, parent::*, *}; +use coupler::{buffers::*, bus::*, events::*, params::*, parent::*, *}; #[derive(Params, Serialize, Deserialize, Clone)] struct GainParams { diff --git a/src/format/clap/instance.rs b/src/format/clap/instance.rs index acb799b..5998b49 100644 --- a/src/format/clap/instance.rs +++ b/src/format/clap/instance.rs @@ -12,7 +12,7 @@ use clap_sys::{events::*, id::*, plugin::*, process::*, stream::*}; use crate::buffers::{Buffers, BusData}; use crate::bus::{BusDir, Format}; use crate::events::{Data, Event, Events}; -use crate::param::ParamInfo; +use crate::params::ParamInfo; use crate::sync::params::ParamValues; use crate::util::{copy_cstring, slice_from_raw_parts_checked, DisplayParam}; use crate::{Config, Editor, Host, ParamId, ParamValue, Plugin, PluginInfo, Processor}; diff --git a/src/lib.rs b/src/lib.rs index 9f1a652..69fd0d9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ pub mod buffers; pub mod bus; pub mod events; pub mod format; -pub mod param; +pub mod params; pub mod parent; mod sync; @@ -13,7 +13,7 @@ mod util; use buffers::Buffers; use bus::{BusInfo, Layout}; use events::Events; -use param::ParamInfo; +use params::ParamInfo; use parent::Parent; pub type ParamId = u32; diff --git a/src/param.rs b/src/params.rs similarity index 100% rename from src/param.rs rename to src/params.rs diff --git a/src/util.rs b/src/util.rs index 434a8b8..5c46207 100644 --- a/src/util.rs +++ b/src/util.rs @@ -3,7 +3,7 @@ use std::fmt::{self, Display, Formatter}; use std::os::raw::c_char; use std::slice; -use crate::param::ParamInfo; +use crate::params::ParamInfo; use crate::ParamValue; pub fn copy_cstring(src: &str, dst: &mut [c_char]) {