| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
this adds subsititutions, which work similar to the
`Dhall.substitutions` mechanism of the Haskell dhall package, and which
can be used e.g. like this:
```rust
serde_dhall.from_str(...)
.substitute_names(hashmap!["Newtype" => static_type])
.parse::<SimpleType>()?
```
The idea behind this is to make it easy to add programmer-defined types
which may be used in configs for programs, without forcing the program's
users to re-import the same type definitions each time (or the
programmers to keep the dhall-based definitions in sync with their rust
types, since these are now generated automatically).
Caveats so far:
- makes some of the code ugly (dhall internals are now used in
serde_dhall/src/lib.rs, for example)
- haven't tested error messages so far
- some unecessary copying of strings and static type values
|