I don't see any Enum
I have this file .ron:
Price(
model: Model(
A(0.02),
B(0.094),
C(0.05),
D(0.02),
E(0.004),
F(0.001),
),
tool: Tool(
A(0.006),
B(0.3),
)
)
but I don't know if this will work like this:
#[derive(Debug, Deserialize)]
struct Price {
model: Model,
tool: Tool
}
#[derive(Debug, Deserialize)]
enum Model {
A(f64),
B(f64),
C(f64)
D(f64),
E(f64),
F(f64)
}
#[derive(Debug, Deserialize)]
enum Model {
A(f64),
B(f64)
}
I didn't see examples about enum
I think if I'm not wrong the .ron file should be like this:
Price(
model: [
A(0.02),
B(0.094),
C(0.05),
D(0.02),
E(0.004),
F(0.001),
],
tool: [
A(0.006),
B(0.3),
]
)
and deserialization like this:
#[derive(Debug, Deserialize)]
struct Price {
model: Vec<Model>,
tool: Vec<Tool>
}
#[derive(Debug, Deserialize)]
enum Model {
A(f64),
B(f64),
C(f64)
D(f64),
E(f64),
F(f64)
}
#[derive(Debug, Deserialize)]
enum Model {
A(f64),
B(f64)
}
Yes, I think your second version is correct and should work
yes it works, thanks and great job for this text format!
Can we reopen this? the format for enums is somehow still not documented anywhere I can find.
@rkanati What examples would you like to see?
Just literally any example of what an enum looks like in ron in the rustdocs.