Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.
Rust agent-skillsclaude-codeclicode-migrationcodexffigolangjavajavascriptmcpmigrationnapiperformanceportingpyo3pythonrewriterubyrusttypescript
using System;
using System.Text.RegularExpressions;
using Acme.Textkit.Util;
namespace Acme.Textkit.Text;
public static class Slug
{
public static string Slugify(string text, string sep = "-")
{
var ascii = Ascii.Fold(text);
var slug = Regex.Replace(ascii.ToLowerInvariant(), "[^a-z0-9]+", sep);
return slug.Trim(sep.ToCharArray());
}
public static string Truncate(string text, int max)
{
if (max < 0)
{
throw new ArgumentOutOfRangeException(nameof(max), "max must not be negative");
}
return text.Length <= max ? text : text.Substring(0, max);
}
}