multiprint 0.1.3

A convenient string multiplication utility crate
Documentation
  • Coverage
  • 77.78%
    7 out of 9 items documented1 out of 8 items with examples
  • Size
  • Source code size: 10.27 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.27 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • carribus/rust-multiprint
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • carribus

Build Status cratesio docsrs

MultiPrint - A convenient string value multiplier trait for Rust

This is a basic crate that provides a string multiplier Trait and implements it for Rust's std::str::String.

If you wish to implement the MultiPrint trait for your types, you will need to ensure that those types support the ToString trait which is implemented by default when you implement std::fmt::Display.

An example of using the crate:

use multiprint::{MultiPrint, Decorate};

fn main() {
    let s = String::from("Echo..");
    println!("{}", s.times(5, ' '));

    assert_eq!(s.times(5, ' '), "Echo.. Echo.. Echo.. Echo.. Echo..");
    assert_eq!("Hello!".to_string().times(2, ' '), "Hello! Hello!");

    // this will output:
    //
    //   Header 1
    //   --------
    //
    println!("{}", "Header 1".to_string().underline('-'));

    // this will output:
    //
    //   --------
    //   Header 1
    //
    println!("{}", "Header 1".to_string().overline('-'));

    // this will output:
    //
    //   ________
    //   Header 1
    //   ========
    //
    println!("{}", "Header 1".to_string().outline('_', '='));

    // this will output:
    //
    //   ------------
    //   | Header 1 |
    //   ------------
    //
    println!("{}", "Header 1".to_string().border('-', '|'));
}

Example(s)

At the moment, there is only one example since the crate is quite simple. If the complexity grows over time, I will add more targetted examples. In the meanwhile, to run the example, just type:

$ cargo run --example sample_headers