Lukas Kalbertodt
9d57b048ce
Improve documentation
2022-11-06 12:26:36 +01:00
Lukas Kalbertodt
49828fc2e3
Change API of parse_env functions
...
I think this is an overall improvement. A few things done here:
- They are available as `::env::parse` instead of `::env_utils`. The
`env` module gets functions of its own soon enough.
- Renamed functions to be shorter: `list_by_sep`, `list_by_comma`, ...
- The docs were adjusted. One example is enough. And the functions with
a fixed separator don't need the full docs again. That way we can
avoid the `paste` dependency.
- Functions now always return `Result<C, _>`. While the previous version
was slightly more flexible, I don't think anyone would benefit from
that flexibility (as `parse_env` requires `Result<_, _>` anyway) and
this way it's a bit clearer what the function does, especially for
those who don't know the nifty `FromIterator for Result` impl.
- The example was adjusted accordingly. I also changed the names to
obviously dummy names as I didn't know the existing names and don't
want to spend time investigating whether I want their names in my
code base :D
2022-11-06 12:26:36 +01:00
Cyphersnake
cb8f879b92
Add parse_env attribute to confique::Config macro
...
Since there is no established format for representing collections within env variables, to enable their support, the feature with a custom parser attribute added.
Add helpers for parsing env variables into collections
Improve rustdoc for `env_utils` functions
Improve `parse_env` example
2022-11-06 10:18:42 +04:00
Lukas Kalbertodt
0e47eb7acf
Format code
...
This is `cargo fmt` but with lots of changes reverted and some adjusted.
2022-10-24 10:13:06 +02:00
Lukas Kalbertodt
d1a62e47eb
Add map default values (e.g. default = { "foo": 33 })
...
This commit also adds a bunch of tests testing maps in several
situations.
2022-10-21 18:13:59 +02:00
Lukas Kalbertodt
2e432b1f4a
Improve docs
2022-10-21 15:27:29 +02:00
Lukas Kalbertodt
bc03ecaf4e
Remove a bunch of cfg attributes
2022-10-21 13:13:32 +02:00
Lukas Kalbertodt
4533f2b2d4
Fix visibility of template module and items
...
The trait and `template::format` are now crate-private as I don't want
to expose that API surface (alongside the `TomlFormatter` types).
2022-10-21 12:39:41 +02:00
Lukas Kalbertodt
a784e6ee64
Rename format to template (except template::format())
2022-10-21 12:02:13 +02:00
Lukas Kalbertodt
9b9610a6ac
Add JSON5 support
2022-10-21 11:52:53 +02:00
Lukas Kalbertodt
65d0b7ca17
Fix minor docs formatting issue
2022-10-11 12:59:54 +02:00
Lukas Kalbertodt
8db8fcafc4
Add two toml::format tests
2022-04-07 14:00:56 +02:00
Lukas Kalbertodt
1c6ecdd4ad
Fix doctests using derive
...
See https://github.com/rust-lang/rust/issues/83583
2022-03-30 17:38:39 +02:00
Lukas Kalbertodt
4f4f42e8f3
Disable some code (and fix others) when no features are enabled
2021-07-28 12:38:50 +02:00
Lukas Kalbertodt
8a520927a2
Add crate-level documentation
2021-07-28 12:02:09 +02:00
Lukas Kalbertodt
00dbe4dc0a
Fix compilation failure for --no-default-features
2021-07-27 17:16:06 +02:00
Lukas Kalbertodt
cc1a0eba5e
Minor documentation improvements
2021-07-27 16:20:24 +02:00
Lukas Kalbertodt
a86ab50588
Add more documentation to Config trait and derive
2021-07-27 16:15:05 +02:00
Lukas Kalbertodt
0bc105b22d
Add yaml::format
2021-07-27 15:05:07 +02:00
Lukas Kalbertodt
aa5eb06f49
Add Partial::from_env and implement it in derive macro
2021-07-27 01:12:57 +02:00
Lukas Kalbertodt
3ac922ca2f
Add deserialization logic for reading values from environment variables
2021-07-27 01:10:12 +02:00
Lukas Kalbertodt
3c7376035c
Add Config::from_file
2021-07-25 10:56:46 +02:00
Lukas Kalbertodt
9c5990d803
Add Partial::is_empty and Partial::is_complete
2021-07-25 10:06:46 +02:00
Lukas Kalbertodt
ca5bb2488f
Add Builder type as convenient high level loading API
2021-07-25 09:45:59 +02:00
Lukas Kalbertodt
76373278b0
Remove Source trait and Config::from_sources
...
I'm not sure about a good high level API.
2021-07-24 22:25:40 +02:00
Lukas Kalbertodt
522494aa5c
Fix derive macro for pub(crate) visibility
2021-07-24 18:48:15 +02:00
Lukas Kalbertodt
ceb9799e55
Add toml module with format function for config templates
2021-07-24 18:48:15 +02:00
Lukas Kalbertodt
b71eaa0464
Add Config::META to access the configuration definition at runtime
2021-07-24 18:48:13 +02:00
Lukas Kalbertodt
0d25489a31
Move error code to error.rs
2021-05-16 16:09:49 +02:00
Lukas Kalbertodt
d11f18e5f0
Move File and FileFormat to the crate root
...
The crate root is not super busy yet, so it's more convenient to have
no public sub modules.
2021-05-16 16:07:36 +02:00
Lukas Kalbertodt
b57382f546
Add some documentation
2021-05-16 15:59:33 +02:00
Lukas Kalbertodt
32fbfd3a5a
Add Source trait and implement it for files (TOML and YAML for now)
2021-05-16 15:27:47 +02:00
Lukas Kalbertodt
8abc07bcda
Add handling of nested configuration types via #[config(child)]
2021-05-14 22:13:31 +02:00
Lukas Kalbertodt
0f37618c19
Rewrite everything to be based on derives (WIP)
2021-05-14 16:30:50 +02:00
Lukas Kalbertodt
bfab0e8798
Add example module for documentation
...
It currently doesn't show anything as all items are pub(crate).
2021-04-29 19:00:36 +02:00
Lukas Kalbertodt
1ae45a3e7c
Move TryFromError from generated code into main crate
...
There is not really a point in generating this type for every
invocation. Also reduces the number of things magically generated.
2021-04-29 18:41:17 +02:00
Lukas Kalbertodt
537a8b7725
Add version from other project
...
This was mostly what I implemented as utility library for another
project. But I figured I can also extract it as it's useful on its
own.
2021-04-29 18:09:26 +02:00
Lukas Kalbertodt
dd52b56548
Initial commit with empty Cargo project
2021-04-29 17:23:54 +02:00