Crate cattocol

source ·
Expand description

This crate provided various options for combining text.

  • Without the ansi escpe sequences.
  • With the ansi escpe sequences.
  • Along the lines of the first text.
  • Iteration on non empty lines.

Examples

let first_txt = String::from("It's a\nit's raining\nnortherly wind.");
let second_txt = String::from("beautiful day,\nwith a\n\n");
let cattocol = CatToCol::new().fill(' ').repeat(0);
let text = "It's a         beautiful day,\nit's raining   with a\nnortherly wind.\n";
let concatenated_txt = cattocol.combine_col(&first_txt, &second_txt).collect::<String>();

assert_eq!(concatenated_txt, text);

println!("{}", concatenated_txt);

//It's a         beautiful day,
//it's raining   with a
//northerly wind.

let text = "It's a beautiful day,\nit's raining with a\nnortherly wind. \n";
let concatenated_txt = cat_to_col(&first_txt, &second_txt).collect::<String>();

assert_eq!(concatenated_txt, text);

println!("{}", concatenated_txt);

//It's a beautiful day,
//it's raining with a
//northerly wind.

Structs

  • A structure to store the delimiter character and its repetition value.

Functions

  • Concatenating four texts along the lines of the first text returns an iterator.
  • Concatenating two texts along the lines of the first text returns an iterator.
  • Concatenating two texts by lines parwise returns an iterator.
  • Concatenating three texts along the lines of the first text returns an iterator.
  • Concatenating two texts line by line returns an iterator.