field_types icon indicating copy to clipboard operation
field_types copied to clipboard

Feature: derive attributes

Open thomas9911 opened this issue 2 years ago • 0 comments

I have a struct similar to this.

use serde::{Deserialize, Serialize};

#[derive(FieldName)]
#[field_name_derive(Serialize, Deserialize)]
pub struct Test {
    pub snake_case: String,
}

which generates:

#[field_name_derive(Serialize, Deserialize)]
pub struct Test {
    pub snake_case: String,
}

#[derive(Serialize, Deserialize)]
pub enum TestFieldName {
    SnakeCase,
}

It would be nice if there is a way that I could have this:

#[field_name_derive(Serialize, Deserialize)]
pub struct Test {
    pub snake_case: String,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum TestFieldName {
    SnakeCase,
}

So that name and by_name behave the same as the serde implementations.

Is this a feature you consider adding?

thomas9911 avatar Oct 08 '23 18:10 thomas9911