Age | Commit message (Collapse) | Author |
|
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
Misc changes
|
|
This patch changes the Display impl for ValueKind so that Array and
Table are nicely displayed.
This basically changes a user-facing implementation in a
non-backwards-compatible way. But as the documentation for std states:
Display is similar to Debug, but Display is for user-facing output
[...]
This is user-facing and I'd say this is okay.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
This patch removes the ConfigKind::Frozen mechansim, which wasn't
exported through the public interface at all.
Because the ::Frozen variant was removed, the ConfigKind::Mutable
variant is the only one remaining and because the ConfigKind type isn't
exported in the API as well, we can move the variant members to the
Config struct itself.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
This patch simplifies the Source::collect_to() default implementation by
making use of the ? operator as well as the std::iter API.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
And remove the dead code bit.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
|
|
Remove Config::new()
|
|
|
|
Removes the ::new() constructor, because Config::default() does the
same.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
|
|
Add setter for setting config value once
|
|
Config::merge() overwrite it later
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
This patch adds a builder-pattern version of Config::merge(), which can
be used for method-chain-building Config objects.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
Because clippy complains on nightly.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
|
|
|
|
Allow arbitrary types of map keys
|
|
|
|
Of particular interest are maps that have numbers or enums as keys.
Closes #74.
|
|
|
|
While using this library, I end up having lifetime issues with
`Config::get`. I've seen that current implementation forces the calleer
to match `key` lifetime to the output of the function.
My use case is, under some circumstances, return a suffixed version of
the config key. Something similar to:
```
if some_condition == true {
let key_name = format!("{}_suffix", key);
self.config.get(&key_name)
} else {
self.config.get(key)
}
```
This code is noy compiling for me due to conflicting lifetimes. To avoid
this, I've started looking to the code and I've found that `key` needed
this lifetime because of `ValueWithKey`. The purpouse of this struct
seems to be add more information to the errors that are returned to the
user.
To mitigate this lifetime coupling I've:
- Mapped the error on `Config::get` to include the originating key of
the current error
- Remove all the code related with `ValueWithKey`
|
|
works thanks to #106
|
|
|
|
|
|
|
|
|
|
Related to #83, but doesn't solve that specific problem :-(. That
specific error message ("missing field") comes from somewhere else than
this library.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|