Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust struct naming #2

Open
teamplayer3 opened this issue Oct 5, 2022 · 0 comments
Open

Adjust struct naming #2

teamplayer3 opened this issue Oct 5, 2022 · 0 comments
Labels

Comments

@teamplayer3
Copy link
Owner

Use structure types as in rust structures.

NewType as in new type idiom.

Match to serde ast style

// unit struct     -> Style::Unit
struct A;

// new type struct -> Style::Newtype
struct B(u8);

// tuple struct    -> Style::Tuple
struct C(u8, u16);

// struct (c-like) -> Style::Struct
struct D {
    a: u8,
    b: u16,
}

// enum
enum E {
    A,            // unit struct                     -> unit variant     -> Style::Unit
    B(u8),        // new type struct/ tuple struct   -> new type variant -> Style::Newtype
    C(u8, u16),   // tuple struct                    -> tple variant     -> Style::Tuple
    D {           // struct (c-like)                 -> struct variant   -> Style::Struct
        a: u8,
        b: u16
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant