names_changer/lib.rs
1// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
2// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
4// option. This file may not be copied, modified, or distributed
5// except according to those terms.
6//! # Overview
7//! Taking data as str.
8//! This crate `#[names_changer]` provides trait method `.camel_to_snake()` that convert a names from camel case to snake case.
9//! The trait searches for words matching the pattern and converts them to snake case.
10//!
11//! # Getting Started
12//!
13//! First of all you have to add this dependency to your `Cargo.toml`:
14//!
15//! ```toml
16//! [dev-dependencies]
17//! names-changer = "0.2.1"
18//! ```
19//!
20//! Additionally, you have to import the procedural macro with `use` statement:
21//!
22//! ```rust
23//! use names_changer::NamesChanger;
24//! ```
25//!
26//! # Example usage:
27//!
28//! ```rust
29//! #[cfg(test)]
30//! mod tests {
31//! use names_changer::NamesChanger;
32//!
33//! // Not needed for this example, but useful in general
34//! use super::*;
35//!
36//! #[test]
37//! fn test_name_change() {
38//! let content = "TABLE ClientTokensRef IS 'text';";
39//!
40//! assert_eq!("TABLE client_tokens_ref IS 'text';", content.camel_to_snake())
41//! }
42//! }
43//! ```
44
45mod names_changer;
46
47pub use self::names_changer::NamesChanger;