Custom Attribute Panicked:Unsupported Argument Type
Hello,
I'm running into this error when using enum_dispatch.
use undo::{Action, History, Merged};
use enum_dispatch::enum_dispatch;
pub struct AppState{
names: Vec<String>
}
#[enum_dispatch(AppActionTest)]
pub trait AppAction{
fn apply(&mut self, target: &mut AppState) -> Result<(), String>;
fn undo(&mut self, target: &mut AppState) -> Result<(), String>;
fn redo(&mut self, target: &mut AppState) -> Result<(), String> {
self.apply(target)
}
fn merge(&mut self, _: &mut AppActionTest) -> Merged {
Merged::No
}
}
pub struct AddMask;
impl Action for AddMask{
type Target = AppState;
type Output = ();
type Error = String;
fn apply(&mut self, target: &mut AppState) -> Result<(), String>{
dbg!("APPLYING ADD MASK");
Ok(())
}
fn undo(&mut self, target: &mut AppState) -> Result<(), String>{
Ok(())
}
fn redo(&mut self, target: &mut AppState) -> Result<(), String> {
self.apply(target)
}
}
#[enum_dispatch]
pub enum AppActionTest {
AM(AddMask)
}
fn main(){
dbg!("running");
}
gives error statement:
error: custom attribute panicked
--> src\main.rs:41:1
|
41 | #[enum_dispatch]
| ^^^^^^^^^^^^^^^^
|
= help: message: Unsupported argument type
error[E0412]: cannot find type `AppActionTest` in this scope
--> src\main.rs:19:33
|
19 | fn merge(&mut self, _: &mut AppActionTest) -> Merged {
| ^^^^^^^^^^^^^ not found in this scope
error: aborting due to 2 previous errors
I created a repo with this code if you'd like to run it.