not-fl3 / nanoserde

Serialisation library with zero dependencies
689 stars 39 forks source link

Support Enum numbered variant parsing #102

Closed flukejones closed 4 months ago

flukejones commented 5 months ago

Allows ser/de of enums such as:

pub enum Fud {
    A = 0,
    B = 1,
    C = 2,
}

Should close #101

flukejones commented 5 months ago

I don't know if this is the best way to do this, I'm basically making a hard assumption that and enum variant with <Var> = <num>, always being correct.

knickish commented 5 months ago

I've been traveling for work this week, so haven't had time to review yet. Will try to get it done by end of the weekend at least. Thanks for putting this up

flukejones commented 5 months ago

No worries mate. Turns out I can't use it in the areas I wanted to due to the pervasiveness of serde, but I have a few other projects I'll be converting.

knickish commented 4 months ago

@flukejones Would you mind backing out my commit on this so I can clean it up and merge these separately?

flukejones commented 4 months ago

Oh crap sorry I thought you'd already merged. Will do this soon

flukejones commented 4 months ago

Should be done now

knickish commented 4 months ago

Thanks @flukejones , this is in now