Files
zed/crates/gpui/tests/action_macros.rs
Piotr Osiewicz 37239fd66b Use serde 1.0.221 instead of serde_derive hackery (#38137)
serde 1.0.221 introduced serde_core into the build graph, which should
render explicitly depending on serde_derive for faster build times an
obsolote method.

Besides, I'm not even sure if that worked for us. My hunch is that at
least one of our deps would have `serde` with derive feature enabled..
and then, most of the crates using `serde_derive` explicitly were also
depending on gpui, which depended on `serde`.. thus, we wouldn't have
gained anything from explicit dep on `serde_derive`

Release Notes:

- N/A
2025-09-14 14:01:04 +02:00

56 lines
1.3 KiB
Rust

use gpui::{Action, actions};
use gpui_macros::register_action;
use schemars::JsonSchema;
use serde::Deserialize;
#[test]
fn test_action_macros() {
actions!(
test_only,
[
SomeAction,
/// Documented action
SomeActionWithDocs,
]
);
#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
#[action(namespace = test_only)]
#[serde(deny_unknown_fields)]
struct AnotherAction;
#[derive(PartialEq, Clone, gpui::private::serde::Deserialize)]
#[serde(deny_unknown_fields)]
struct RegisterableAction {}
register_action!(RegisterableAction);
impl gpui::Action for RegisterableAction {
fn boxed_clone(&self) -> Box<dyn gpui::Action> {
unimplemented!()
}
fn partial_eq(&self, _action: &dyn gpui::Action) -> bool {
unimplemented!()
}
fn name(&self) -> &'static str {
unimplemented!()
}
fn name_for_type() -> &'static str
where
Self: Sized,
{
unimplemented!()
}
fn build(_value: serde_json::Value) -> anyhow::Result<Box<dyn gpui::Action>>
where
Self: Sized,
{
unimplemented!()
}
}
}