1 unstable release
0.1.0 | Feb 13, 2023 |
---|
#2025 in Algorithms
5KB
50 lines
Text Converter
A trait with all methods needed to convert text into a specific format
Example
use text_converter::TextConverter;
struct ReverseText;
impl TextConverter for ReverseText {
fn converter(input: impl AsRef<str>) -> String {
input.as_ref().chars().rev().collect()
}
}
let clipboard_reverse = ReverseText::new_from_clipboard();
let file_reverse = ReverseText::new_from_file("input.txt");
let reverse_text = ReverseText::new_from_text("Hello World!");
assert_eq!("!dlroW olleH", reverse_text);
Dependencies
~0.1–11MB
~120K SLoC