indentasy

Crates.ioindentasy
lib.rsindentasy
version0.3.0
sourcesrc
created_at2021-11-09 04:16:21.641492
updated_at2021-12-09 01:18:32.306098
descriptionIndent like a party
homepage
repositoryhttps://github.com/haoadoresorange/indentasy.git
max_upload_size
id478740
size4,983
(haoadoreorange)

documentation

README

Indentasy

Indent like a party

Rust implementation of https://cwestblog.com/2014/01/02/javascript-indenting-text/

Examples

fn hello_newline_world() {
    assert_eq!("    hello\n    world", indentasy::indent("hello\nworld", 1, 4));
}

fn newline_hello_newline_world() {
    assert_eq!(
        "\n    hello\n    world",
        indentasy::indent("\nhello\nworld", 1, 4)
    );
}

fn hello_newline_world_indent_with_tab() {
    assert_eq!("\thello\n\tworld", indentasy::indent("hello\nworld", 1, 0));
}

fn hello_newline_world_with_String() {
    assert_eq!(
        "    hello\n    world",
        indentasy::indent("hello\nworld".to_string(), 1, 4)
    );
}
Commit count: 10

cargo fmt