Skip to content

Conversation

Jezza
Copy link

@Jezza Jezza commented Aug 26, 2025

Adds support for generic enums and structs.

So the example from the doc could work like this:

    #[derive(Debug, PartialEq)]
    #[revision::revisioned(revision = 3)]
    pub enum TestEnum<T> {
        #[revision(end = 2, convert_fn = "upgrade_zero")]
        Zero,
        #[revision(end = 2, convert_fn = "upgrade_one")]
        One(T),
        #[revision(start = 2)]
        Two(u64),
        #[revision(start = 2)]
        Three {
            a: i64,
            #[revision(end = 2, convert_fn = "upgrade_three_b")]
            b: f32,
            #[revision(start = 2)]
            c: u32,
            #[revision(start = 3)]
            d: T
        },
    }

Probably not the cleanest code, as I was about halfway writing it when I realised I don't need that functionality.
but I thought I might as well get it working so you could choose to take it or not.

I'm happy to adjust any smaller things.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant