action_macros.rs

 1use gpui2::{actions, impl_actions};
 2use gpui2_macros::register_action;
 3use serde_derive::Deserialize;
 4
 5#[test]
 6fn test_action_macros() {
 7    use gpui2 as gpui;
 8
 9    actions!(test, [TestAction]);
10
11    #[derive(PartialEq, Clone, Deserialize)]
12    struct AnotherTestAction;
13
14    impl_actions!(test, [AnotherTestAction]);
15
16    #[derive(PartialEq, Clone, gpui::serde_derive::Deserialize)]
17    struct RegisterableAction {}
18
19    register_action!(RegisterableAction);
20
21    impl gpui::Action for RegisterableAction {
22        fn boxed_clone(&self) -> Box<dyn gpui::Action> {
23            todo!()
24        }
25
26        fn as_any(&self) -> &dyn std::any::Any {
27            todo!()
28        }
29
30        fn partial_eq(&self, _action: &dyn gpui::Action) -> bool {
31            todo!()
32        }
33
34        fn name(&self) -> &str {
35            todo!()
36        }
37
38        fn debug_name() -> &'static str
39        where
40            Self: Sized,
41        {
42            todo!()
43        }
44
45        fn build(_value: serde_json::Value) -> anyhow::Result<Box<dyn gpui::Action>>
46        where
47            Self: Sized,
48        {
49            todo!()
50        }
51    }
52}