Commit Graph

14 Commits

Author SHA1 Message Date
Lucien Cartier-Tilet c418323b5c
Removed unused `use`s 2020-03-29 03:06:46 +02:00
Lucien Cartier-Tilet c6baa46aca
Removed `import_input`
This should be left to the client crate, `settings::utils::read_file`
is already here for that
2020-03-28 22:38:28 +01:00
Lucien Cartier-Tilet 18eb16e777
Rewritten some parts as macros, updated extension handling
Encoding and decoding of `settings::Settings` now handled in macros to
avoid code repetition. I also wish rewrite them both in a combined
macro that would either encode or decode the struct depending on how
it was called.

Replaced some log warnings with errors

Now if type extension is not valid, the code will still attempt to
decode it, first as JSON data, then as Yaml data. If both fail, then
an error is returned. For this, I added the Display trait to the
`settings::Settings` struct which allows the FromStr trait, and due
to conflicting implementation, I removed the From trait and
implemented manually the `from` method with the same signature -- the
struct just lacks the trait that comes with it.
2020-03-28 22:03:21 +01:00
Lucien Cartier-Tilet d200367ee0
Updated logger options, changed filetype behavior
Replaced lots of warns by errors

Filetype detection won’t return an error on unknown extension anymore,
but will return an `Other` value so it can be handled by other
functions not as an error already. See upcoming commits.
2020-03-28 21:59:23 +01:00
Lucien Cartier-Tilet e9a161f526
Updated `import_input` signature, documentation 2020-03-28 21:58:27 +01:00
Lucien Cartier-Tilet a7ef031090
Final doc before I go to sleep 2020-03-27 23:31:24 +01:00
Lucien Cartier-Tilet 9f5c040893
Added documentation 2020-03-27 23:27:00 +01:00
Lucien Cartier-Tilet 7d0a371311
Changed ruleset variable type to i32 2020-03-27 23:26:16 +01:00
Lucien Cartier-Tilet e00f489f55
Added From trait to Settings 2020-03-27 23:25:16 +01:00
Lucien Cartier-Tilet 8642067eb3
Updated settings::utils::write_file’s signature for more flexibility
`write_file` now accepts as its second argument any type that
implements the `ToString` trait so that not only Strings will be
accepted but any type that can be turned into one.
2020-03-27 19:09:34 +01:00
Lucien Cartier-Tilet 488ceba1bb
Added some doc and tests 2020-03-27 19:08:47 +01:00
Lucien Cartier-Tilet 2e0c16e97c
Added functions to import and export settings and refactoring 2020-03-27 18:25:20 +01:00
Lucien Cartier-Tilet ff95cb05eb
Added some basic code
Added basic settings representation and a way to load them from either
a YAML or Json file.
2020-03-26 20:10:07 +01:00
Lucien Cartier-Tilet 47100b3476
initial commit 2020-03-26 17:04:23 +01:00