Refactor macro handling: add pascal_to_snake utility, rewrite Target handling, and update descriptor structure for bits-based targets.

This commit is contained in:
2026-03-05 21:16:45 +01:00
parent 36b065ddb2
commit a238b63e51
5 changed files with 82 additions and 48 deletions

View File

@@ -24,3 +24,26 @@ pub fn snake_to_title(s: &str) -> String
.collect::<Vec<_>>()
.join(" ")
}
pub fn pascal_to_snake(s: &str) -> String
{
let mut out = String::with_capacity(s.len());
let mut prev_lower = false;
for c in s.chars()
{
if c.is_uppercase()
{
if prev_lower { out.push('_'); }
for lc in c.to_lowercase() { out.push(lc); }
prev_lower = false;
}
else
{
prev_lower = true;
out.push(c);
}
}
out
}