Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use toml; // 0.4.10
- use serde::{Serialize, Deserialize};
- use std::collections::HashMap;
- #[derive(Debug, Serialize, Deserialize)]
- struct AppConfig(HashMap<String, FiletypeConfig>);
- #[derive(Debug, Serialize, Deserialize)]
- struct FiletypeConfig {
- is_test: String,
- strip: String,
- }
- const CONFIG_STR: &str = "[python]
- is_test = '(tests|test)_(\\w+).py'
- strip = 'src/(?P<p>\\w+).py$'
- [elixir]
- is_test = '_test.exs$'
- strip = '(?P<p>[^_\\/]+)_?(\\w+)?.ex$'";
- fn main() {
- let conf = toml::from_str::<AppConfig>(CONFIG_STR);
- dbg!(conf);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement