Giter Club home page Giter Club logo

Comments (5)

SergioBenitez avatar SergioBenitez commented on June 18, 2024 1

That functionality is now available in the just release 0.10.14.

from figment.

johanster avatar johanster commented on June 18, 2024 1

That's awesome, thanks for the quick turnaround. Just verified that 0.10.14 works with my use case. I really appreciate it!

From the serde_yaml documentation I thought the "bang-tagging" syntax was the way to go. I like the default serialization representation better.

from figment.

johanster avatar johanster commented on June 18, 2024

Hmm, looking at the dependencies I used I now realize that I'm mixing different versions of serde and serde_yaml. I used the same version of serde_yaml as Figment to make a fair test, but pasted the serde version for deserialize trait from my app. Could this be the root cause of my issues perhaps?

Edit: Never mind, I just saw that serde_yaml hasn't reached 1.0 yet.

from figment.

SergioBenitez avatar SergioBenitez commented on June 18, 2024

Interesting. The YAML crate has a special encoding for custom data type tags, i.e. !Foo, that it recognizes. For instance, that YAML doesn't deserialize into a serde_json::Value either:

let conf: serde_json::Value = serde_yaml::from_str(YAML).unwrap();

// called `Result::unwrap()` on an `Err` value: Error("scripts[0].trigger: invalid type: enum, expected any valid JSON value", line: 4, column: 14)

Perhaps we can emulate the behavior.

from figment.

SergioBenitez avatar SergioBenitez commented on June 18, 2024

Note that this YAML syntax, which matches the default deserialization representation expected by Rust enums generated by #[derive(Deserialize), works just fine:

scripts:
  - path: pong.script
    trigger:
      Start:
  - path: ping.script
    trigger:
      Inter:
        sec: 5

from figment.

Related Issues (20)

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.