text_converter

Crates.iotext_converter
lib.rstext_converter
version0.1.0
sourcesrc
created_at2023-02-13 12:14:19.985312
updated_at2023-02-13 12:14:19.985312
descriptionA trait that helps with manipulating text
homepage
repositoryhttps://github.com/fruit-bird/text_converter
max_upload_size
id783905
size4,838
Hamza Hraiche (fruit-bird)

documentation

README

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);
Commit count: 2

cargo fmt