@zkat is there a Rust library for KDL that's maintained that offers a derive API for generating parsers for typed ASTs? I see Knuffel has what I'm looking for but it seems stale.
@zkat I'd like to avoid the lossy pass through the Serde data model for this use case (a DSL) so it looks like knus might be the best bet for now.
@esoterra what’s lossy? You should be able to express the same things as knus. It just happens that kdl-rs uses special renames as its DSL. You can be precise in how you tell it to convert things.
@zkat can you clarify this remark?
"The most notable restriction is the ability to distinguish between arguments, properties and child nodes, as JSON does not have such conception.
Due to that the mapping is performed in a best effort manner."
I took it to mean that the deserialization cannot distinguish between two syntactic KDL constructs which produce the same abstract Serde data at deserialization time.
So for example if you wanted to say "in my KDL-based DSL the foo node may contain the bar node with a string argument, but this is not equivalent to a foo node with a bar property that has a string value" you couldn't do that.
This seems to be supported by:
"A KDL node with both properties and children merges them into a single map."
Unless I'm misunderstanding, that makes the kdl-rs library significantly less expressive than knus for which arguments, properties, and children can be explicitly annotated and are then validated for you.
@zkat what's the equivalent to #[derive(knus::Decode)]?
```rs
#[derive(knus::Decode)]
struct Route {
#[knus(argument)]
path: String,
#[knus(children(name="route"))]
subroutes: Vec<Route>,
}
```
@esoterra https://docs.rs/kdl
kdl - Rust