Writing an abbreviator library in Rust