Skip to content

add ability to manually name enum variants, currently it is bound to kebab-case #12

Open
@twop

Description

this what I currently have in mind

#[derive(knus::Decode, Debug)]
enum Text {
    #[knus(name="Raw")]
    Raw(Raw),

    #[knus(name="CallFunc")]
    CallFunc(Call),
}

This is in part inspired by zellij style of APIs, where commands are using pascal case: https://zellij.dev/documentation/keybindings-possible-actions

Note that if my understanding is correct then my assumption that it will be possible to name two variants the same, and thus enabling patterns like this:

// note that "text" node should have either one argument or a nested node only
// thus enum might be a good data structure for that 

text "raw text"

text {
  call "funcName"
}

although, no promises that the last one will work, depends greatly on the code structure.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions