-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
40 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: rustup toolchain install stable --profile=minimal --component clippy --component rustfmt | ||
- run: cargo clippy --all-features -- -D warnings | ||
- run: cargo fmt --all -- --check | ||
|
||
test: | ||
strategy: | ||
matrix: | ||
os: [macos-latest, ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: rustup toolchain install stable --profile=minimal | ||
- run: cargo test --all-features |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,9 @@ | ||
[package] | ||
name = "configuration" | ||
version = "0.7.2" | ||
version = "0.8.0" | ||
license = "Apache-2.0/MIT" | ||
authors = ["Ivan Ukhov <[email protected]>"] | ||
description = "The package provides a malleable tree structure." | ||
description = "The package provides a means of configuration." | ||
documentation = "https://docs.rs/configuration" | ||
homepage = "https://github.com/stainless-steel/configuration" | ||
repository = "https://github.com/stainless-steel/configuration" | ||
|
||
[features] | ||
default = ["toml"] | ||
|
||
[dependencies] | ||
options = "0.5" | ||
|
||
[dependencies.toml] | ||
version = "0.1" | ||
optional = true | ||
default-features = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,16 @@ | ||
# Configuration [![Version][version-img]][version-url] [![Status][status-img]][status-url] | ||
# Configuration [![Package][package-img]][package-url] [![Documentation][documentation-img]][documentation-url] [![Build][build-img]][build-url] | ||
|
||
The package provides a malleable tree structure. | ||
|
||
## [Documentation][documentation] | ||
|
||
## Example | ||
|
||
```rust | ||
let tree = configuration::format::TOML::parse(r#" | ||
message = "one" | ||
[foo.bar] | ||
message = "two" | ||
[foo.baz] | ||
answer = 42 | ||
"#).unwrap(); | ||
|
||
assert_eq!(tree.get::<String>("message").unwrap(), "one"); | ||
assert_eq!(tree.get::<String>("foo.message").unwrap(), "one"); | ||
assert_eq!(tree.get::<String>("foo.bar.message").unwrap(), "two"); | ||
assert_eq!(tree.get::<String>("foo.baz.message").unwrap(), "one"); | ||
|
||
let tree = tree.branch("foo.baz").unwrap(); | ||
|
||
assert_eq!(tree.get::<i64>("answer").unwrap(), &42); | ||
``` | ||
The package provides a means of configuration. | ||
|
||
## Contribution | ||
|
||
Your contribution is highly appreciated. Do not hesitate to open an issue or a | ||
pull request. Note that any contribution submitted for inclusion in the project | ||
will be licensed according to the terms given in [LICENSE.md](LICENSE.md). | ||
|
||
[documentation]: https://docs.rs/configuration | ||
[status-img]: https://travis-ci.org/stainless-steel/configuration.svg?branch=master | ||
[status-url]: https://travis-ci.org/stainless-steel/configuration | ||
[version-img]: https://img.shields.io/crates/v/configuration.svg | ||
[version-url]: https://crates.io/crates/configuration | ||
[build-img]: https://github.com/stainless-steel/configuration/workflows/build/badge.svg | ||
[build-url]: https://github.com/stainless-steel/configuration/actions/workflows/build.yml | ||
[documentation-img]: https://docs.rs/configuration/badge.svg | ||
[documentation-url]: https://docs.rs/configuration | ||
[package-img]: https://img.shields.io/crates/v/configuration.svg | ||
[package-url]: https://crates.io/crates/configuration |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1 @@ | ||
//! Malleable tree structure. | ||
//! | ||
//! ``` | ||
//! let tree = configuration::format::TOML::parse(r#" | ||
//! message = "one" | ||
//! | ||
//! [foo.bar] | ||
//! message = "two" | ||
//! | ||
//! [foo.baz] | ||
//! answer = 42 | ||
//! "#).unwrap(); | ||
//! | ||
//! assert_eq!(tree.get::<String>("message").unwrap(), "one"); | ||
//! assert_eq!(tree.get::<String>("foo.message").unwrap(), "one"); | ||
//! assert_eq!(tree.get::<String>("foo.bar.message").unwrap(), "two"); | ||
//! assert_eq!(tree.get::<String>("foo.baz.message").unwrap(), "one"); | ||
//! | ||
//! let tree = tree.branch("foo.baz").unwrap(); | ||
//! | ||
//! assert_eq!(tree.get::<i64>("answer").unwrap(), &42); | ||
//! ``` | ||
extern crate options; | ||
|
||
#[cfg(feature = "toml")] | ||
extern crate toml; | ||
|
||
macro_rules! ok( | ||
($result:expr) => (match $result { | ||
Ok(result) => result, | ||
Err(error) => raise!(error), | ||
}); | ||
); | ||
|
||
macro_rules! raise( | ||
($message:expr) => (return Err(::Error($message.to_string()))); | ||
($($argument:tt)*) => (return Err(::Error(format!($($argument)*)))); | ||
); | ||
|
||
pub mod format; | ||
|
||
mod node; | ||
mod result; | ||
mod tree; | ||
|
||
pub use node::Node; | ||
pub use result::{Error, Result}; | ||
pub use tree::Tree; | ||
//! Means of configuration. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.