I cannot run the final example on data binder shown on https://crates.io/crates/more-config. I manage to compile the code adding the dependencies to cargo.toml:
[dependencies]
more-config = { version = "2.1.0", features = [ "cmd","mem","json","binder" ] }
serde = { version = "*", features = ["derive"] }
The compiler chokes on line:
println!("{}", &config.text);
with error:
error[E0609]: no field `text` on type `Box<dyn ConfigurationRoot<Target = (dyn Configuration + 'static)>>`
But it compiles just fine when changing the line to:
println!("{}", &app.text);
However when run, the binary compiled crashes with error:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: MissingValue("text")', /home/nicmel/.cargo/registry/src/github.com-1ecc6299db9ec823/more-config-2.1.0/binder.rs:42:32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Where the content of demo.json is copied straight from the doc page:
{
"text": "Hello world",
"demo": true,
"clients": [{
"region": "us-west",
"url": "https://tempuri.org"
}]
}
My Rust version:
user@host:~$ rustc --version
rustc 1.65.0-dev
user@host:~$
Same example without binding seem to work just fine.
I cannot run the final example on data binder shown on https://crates.io/crates/more-config. I manage to compile the code adding the dependencies to
cargo.toml:The compiler chokes on line:
with error:
But it compiles just fine when changing the line to:
However when run, the binary compiled crashes with error:
Where the content of
demo.jsonis copied straight from the doc page:My Rust version:
Same example without binding seem to work just fine.