From 0e3e3cedb45e0f330167bc2462ecfa9038d7ed9f Mon Sep 17 00:00:00 2001 From: Mirko Covizzi Date: Mon, 27 Apr 2020 17:32:54 +0200 Subject: [PATCH 1/3] Address interface ordering issue --- com/macros/support/src/utils/idents.rs | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/com/macros/support/src/utils/idents.rs b/com/macros/support/src/utils/idents.rs index e8d122b..f9fbb0b 100644 --- a/com/macros/support/src/utils/idents.rs +++ b/com/macros/support/src/utils/idents.rs @@ -45,8 +45,9 @@ pub fn base_interface_idents(attr_args: &AttributeArgs) -> Vec { for item in &attr.nested { if let NestedMeta::Meta(Meta::Path(p)) = item { - assert!( - p.segments.len() == 1, + assert_eq!( + p.segments.len(), + 1, "Incapable of handling multiple path segments yet." ); base_interface_idents.push( @@ -61,6 +62,22 @@ pub fn base_interface_idents(attr_args: &AttributeArgs) -> Vec { } } + if base_interface_idents.contains(&format_ident!("IComponent")) { + assert_eq!( + base_interface_idents[0], + format_ident!("IComponent"), + "IComponent should always be first." + ); + } + + if base_interface_idents.contains(&format_ident!("IEditController")) { + assert_eq!( + base_interface_idents[0], + format_ident!("IEditController"), + "IEditController should always be first." + ); + } + base_interface_idents } @@ -92,8 +109,9 @@ pub fn get_aggr_map(attr_args: &AttributeArgs) -> HashMap> { for item in &attr.nested { if let NestedMeta::Meta(Meta::Path(p)) = item { - assert!( - p.segments.len() == 1, + assert_eq!( + p.segments.len(), + 1, "Incapable of handling multiple path segments yet." ); aggr_interfaces_idents.push( From b2ffafcf1a3ea03846a053c34776a76934833d9a Mon Sep 17 00:00:00 2001 From: Mirko Covizzi Date: Mon, 27 Apr 2020 17:40:34 +0200 Subject: [PATCH 2/3] Remove unnecessary interfaces from passthru example --- examples/passthru.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/passthru.rs b/examples/passthru.rs index b33880d..2e01843 100644 --- a/examples/passthru.rs +++ b/examples/passthru.rs @@ -36,8 +36,6 @@ unsafe fn wstrcpy(src: &str, dst: *mut c_short) { } #[VST3(implements( - IComponent, - IPluginBase, IEditController, IAudioProcessor, IAutomationState, From 6c895df13b77c105ee7f60212d33825dea4977f2 Mon Sep 17 00:00:00 2001 From: Mirko Covizzi Date: Mon, 27 Apr 2020 18:40:38 +0200 Subject: [PATCH 3/3] Adapt interface ordering issue to single component implementations --- com/macros/support/src/utils/idents.rs | 4 +--- examples/passthru.rs | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/com/macros/support/src/utils/idents.rs b/com/macros/support/src/utils/idents.rs index f9fbb0b..3b7d44b 100644 --- a/com/macros/support/src/utils/idents.rs +++ b/com/macros/support/src/utils/idents.rs @@ -68,9 +68,7 @@ pub fn base_interface_idents(attr_args: &AttributeArgs) -> Vec { format_ident!("IComponent"), "IComponent should always be first." ); - } - - if base_interface_idents.contains(&format_ident!("IEditController")) { + } else if base_interface_idents.contains(&format_ident!("IEditController")) { assert_eq!( base_interface_idents[0], format_ident!("IEditController"), diff --git a/examples/passthru.rs b/examples/passthru.rs index 2e01843..41d26c1 100644 --- a/examples/passthru.rs +++ b/examples/passthru.rs @@ -36,6 +36,7 @@ unsafe fn wstrcpy(src: &str, dst: *mut c_short) { } #[VST3(implements( + IComponent, IEditController, IAudioProcessor, IAutomationState,