moxy-derive 0.0.4

derive macros for moxy crate
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub fn pascal_to_snake(s: &str) -> String {
    let mut result = String::new();

    for (i, ch) in s.chars().enumerate() {
        if ch.is_uppercase() {
            if i > 0 {
                result.push('_');
            }

            result.push(ch.to_lowercase().next().unwrap());
        } else {
            result.push(ch);
        }
    }

    result
}