editor_config/
lib.rs

1//! An [editorconfig](https://editorconfig.org/) parsing library.
2//!
3//! This crate serves as a thin wrapper over the editorconfig specification.
4//!
5//! ## Example
6//!
7//! ```toml
8//! [*]
9//! end_of_line = lf
10//! ```
11//!
12//! Retrieving a property value can be done by providing a section name and property name.
13//!
14//! ```rust
15//! use editor_config::parser::EditorConfig;
16//!
17//!
18//! let editorconfig_path = "tests/test_data/.editorconfig";
19//!
20//! let editorconfig = EditorConfig::from_file(editorconfig_path).unwrap();
21//!
22//! assert_eq!(editorconfig.get_property("*", "end_of_line"), Some(&String::from("lf")));
23//! ```
24//!
25//! This crate only parses keys and returns the values, it does not impose any implementation details on the editor.
26//!
27//! The editorconfig file must be provided to the parser, it does not search the file system.
28//!
29//! Unknown/invalid properties or property values are ignored as per the core library specification. If the parser encounters one, it
30//! will return `None`.
31//!
32//! If a property value is returned, it has been checked and narrowed to confirm it is valid.
33
34pub mod parser;