Code Monkey home page Code Monkey logo

Comments (3)

Wulf avatar Wulf commented on June 19, 2024

hey @RandyMarsh1, thanks for reporting this :)

Let me know if 1.7.0 doesn't work for you. I think eventually what we'll want to do is namespace a lot of this output. Closing this for now, feel free to re-open it

from tsync.

RandyMarsh1 avatar RandyMarsh1 commented on June 19, 2024

Thanks, nested structs within structs now works, this is a great improvement 👍

However the specific scenario I was hoping for was Rust Enums that take a struct of the same name as input parameter like this:

#[tsync]
#[derive(Serialize)]
enum Message {
    MyStruct1(MyStruct1), <-- enum variant name == struct name
    MyStruct2(MyStruct2),
}

This currently does not output anything and is skipped.

The following does output a type but the variants are Strings, not Interfaces.

#[tsync]
#[derive(Serialize)]
enum Message2 {
    MyStruct1,
    MyStruct2,
}

This admittable requires a somewhat opinionated structure but I think is a nice clean way of generating JSON with the Enum variant as key and Struct as Value. The Example code in original post should compile and demonstrates the use case.

from tsync.

Wulf avatar Wulf commented on June 19, 2024

Ah that should be possible too -- do you mind lending me a hand with this one?

from tsync.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.