Introduce pmp-core crate: provide shared proc-macro utilities, strict attribute parsing, and reusable helpers for pmp-* crates.

This commit is contained in:
2026-03-05 08:01:54 +01:00
parent d8b4550392
commit 431fe30e34
9 changed files with 360 additions and 251 deletions

View File

@@ -0,0 +1,26 @@
pub fn pascal_to_title(s: &str) -> String
{
let mut out = String::new();
for (i, ch) in s.chars().enumerate() {
if ch.is_uppercase() && i > 0 { out.push(' '); }
out.push(ch);
}
out
}
pub fn snake_to_title(s: &str) -> String
{
s.split('_')
.map(|word| {
let mut c = word.chars();
match c.next() {
None => String::new(),
Some(f) => f.to_uppercase().collect::<String>() + c.as_str(),
}
})
.collect::<Vec<_>>()
.join(" ")
}