[][src]Function rustwtxt::mutate

pub fn mutate(twtxt: &str, f: fn(_: &str) -> String) -> Vec<String>

Wrapper to apply a function to each line of a twtxt.txt file, returning the resulting lines as a Vec<String>

Examples

let input = "test\ntest";
let output = rustwtxt::mutate(input, |line| {
        line.chars()
            .map(|c| c.to_uppercase().to_string())
            .collect::<String>()
    });
assert_eq!("TEST", output[0]);