You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was reinventing the wheel yesterday (https://github.com/TianyiShi2001/romkan ) before I realize there is already a kana-romaji conversion library here, and this library proved to be faster than mine. However, I think my approach, which is to implement a Trait directly on &str which allows conversion between kana and romaji, is more ergonomic and idiomatic, since it is similar to the std::str's .to_lowercase and .to_uppercase
use romkan::Romkan;fnmain(){println!("{}","kyouhatennkigaiidesune".to_hiragana());println!("{}","きょうはてんきがいいですね".to_romaji());}// compared touse wana_kana::{to_hiragana::to_hiragana, to_romaji::to_romaji};fnmain(){println!("{}", to_hiragana("kyouhatennkigaiidesune"));println!("{}", to_romaji("きょうはてんきがいいですね"));}
Similarly, methods such as .is_hiragana implemented for char will be more ergonomic given there exists .is_alphabetic, .is_digit etc. on char in std.
Would you like these kinds of traits to be added to your crate?
The text was updated successfully, but these errors were encountered:
I was reinventing the wheel yesterday (https://github.com/TianyiShi2001/romkan ) before I realize there is already a kana-romaji conversion library here, and this library proved to be faster than mine. However, I think my approach, which is to implement a Trait directly on &str which allows conversion between kana and romaji, is more ergonomic and idiomatic, since it is similar to the
std::str
's.to_lowercase
and.to_uppercase
Similarly, methods such as
.is_hiragana
implemented forchar
will be more ergonomic given there exists.is_alphabetic
,.is_digit
etc. onchar
instd
.Would you like these kinds of traits to be added to your crate?
The text was updated successfully, but these errors were encountered: