Trying to handle Cargo-like dependency

I've asked sometime here about untagged enums in TOML, and it looks like the solution got something wrong. I get:

Error: Whack manifest at C:\Users\Hydro\Documents\Repository Groups\Whack\whacklib\packages\whack.base\whack.toml
contains invalid TOML: data did not match 
any variant of untagged enum ManifestDependency

Here's whack.toml:

[package]
name = "whack.base"
version = "1.0.0"
authors = ["Matheus Dias de Souza <hydroperfox@gmail.com>"]
license = "Apache-2.0"
description = "The base library of the Whack engine."
source-path = ["src"]

[dependencies]
"as3.lang" = { path = "../as3.lang", version = "1" }

Here's ManifestDependency:

#[derive(Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ManifestDependency {
    Version(Version),
    Advanced {
        version: Option<Version>,
        path: Option<String>,
        git: Option<String>,
        rev: Option<String>,
        branch: Option<String>,
    },
}

Would you mind giving us a minimal reproducible example with your problem? I can't reproduce it.

1 Like

what's the definition of Version? probably it didn't implemtn Deserialize correctly.

1 Like

I'm not being able to provide it because semver doesn't have a serde feature apparently inside the playground.

Version is semver::Version from an use at the top.

I did try using String instead of Version right now, and it looks like something is indeed wrong with from_str or Deserialize as I'm getting:

Error: Whack manifest at "C:\\Users\\Hydro\\Documents\\Repository Groups\\Whack\\whacklib\\packages\\whack.base\\whack.toml"
contains invalid SemVer version at a dependency.

It looks like I did have to use VersionReq, and not Version.