Migrate your app to Rust, one piece at a time, checked against the original's recorded behavior at every step. TypeScript/JavaScript, Python, C, Go, Ruby, Java, Kotlin, PHP, C# and PowerShell
usingSystem;usingSystem.Text.RegularExpressions;usingAcme.Textkit.Util;namespaceAcme.Textkit.Text;publicstaticclassSlug{publicstaticstringSlugify(stringtext,stringsep="-"){varascii=Ascii.Fold(text);varslug=Regex.Replace(ascii.ToLowerInvariant(),"[^a-z0-9]+",sep);returnslug.Trim(sep.ToCharArray());}publicstaticstringTruncate(stringtext,intmax){if(max<0){thrownewArgumentOutOfRangeException(nameof(max),"max must not be negative");}returntext.Length<=max?text:text.Substring(0,max);}}