feat: Renamed all attributes to typed

This commit is contained in:
2025-10-11 00:34:21 +02:00
parent 513b36afdb
commit d30a01aada
6 changed files with 24 additions and 52 deletions

View File

@@ -8,7 +8,7 @@ pub struct B {
#[derive(Typed)]
pub struct A {
#[serde(flatten)]
#[typed(flatten)]
pub b: B,
pub cool: u32,
}

View File

@@ -3,7 +3,7 @@ use std::collections::HashMap;
use lua_typed::Typed;
#[derive(Typed)]
#[serde(rename_all = "snake_case", tag = "action")]
#[typed(rename_all = "snake_case", tag = "action")]
pub enum ActionType {
Broadcast { extras: HashMap<String, String> },
// View,
@@ -23,7 +23,7 @@ fn action_type() {
#[derive(Typed)]
#[repr(u8)]
#[serde(rename_all = "snake_case")]
#[typed(rename_all = "snake_case")]
pub enum Priority {
Min = 1,
Low,
@@ -46,7 +46,7 @@ fn priority() {
#[derive(Typed)]
pub struct Action {
#[serde(flatten)]
#[typed(flatten)]
pub action: ActionType,
pub label: String,
pub clear: Option<bool>,
@@ -69,10 +69,10 @@ fn action() {
pub struct Notification {
pub title: String,
pub message: Option<String>,
#[serde(default)]
#[typed(default)]
pub tags: Vec<String>,
pub priority: Option<Priority>,
#[serde(default)]
#[typed(default)]
pub actions: Vec<Action>,
}

View File

@@ -1,7 +1,7 @@
use lua_typed::Typed;
#[derive(Typed)]
#[serde(rename_all = "invalid/case")]
#[typed(rename_all = "invalid/case")]
pub enum Test {
HelloWorld,
}

View File

@@ -1,5 +1,5 @@
error: Typed does not support this type of rename
--> tests/ui/invalid_rename.rs:4:22
|
4 | #[serde(rename_all = "invalid/case")]
4 | #[typed(rename_all = "invalid/case")]
| ^^^^^^^^^^^^^^

View File

@@ -1,7 +1,7 @@
use lua_typed::Typed;
#[derive(Typed)]
#[serde(tag = "tag")]
#[typed(tag = "tag")]
pub enum Test {
A,
B(String),