Expand description
This crate implements a way of parsing configuration files and interpreting them as different datatypes.
You should be using the provided datastructure datastructure::ParsedData to retrieve
elements inside of your configuration file.
§How to write configuration file
- “!!” represents comments and may be inline.
- Each field must be defined with a name and a value, seperated with a colon
- Supported types are :
- Strings
- 64 bit precision floating point numbers
- Colors (Represented with a name, an hexadecimal string or rgb values)
- Booleans
§Example
!! This is documentation.
!! This is a number
number1: 12.643
!! This is also a number
number2: -12
!! This is a color as an rgb string
color1: (0,255,0)
!! This is a color as an hexadecimal color
color2: #FFFFFF
!! This is a color represented with a name
color3: red
!! This is text
text: "Lorem Ipsum"
!! Those is are booleans
bool1 = yes
bool2 = y
bool2 = true
bool3 = 1 !! Note that this doesn't work for every number, only 1
bool1 = no
bool2 = n
bool2 = false
bool3 = 0§Rust Code Example
let path = Path::new("djal_parser/src/example_config_file.dconfig");
let parsed_data_map = ParsedData::from_file(path).unwrap();
assert_eq(parsedDataMap.as_text("Hello, World !"), Ok("Hello, World !")) Modules§
- color
- The module that contains the
Colorstruct - datastructure
- This module implements a data structure to easily retrieve and interpret data from a parsed text file
- error_
handling - usefull error types that represent error that are in relation with the parsing of text files