3 unstable releases

0.2.0 Mar 16, 2023
0.1.1 Dec 24, 2022
0.1.0 Nov 25, 2022

#431 in Text processing

Download history 7/week @ 2022-12-08 2/week @ 2022-12-15 25/week @ 2022-12-22 4/week @ 2022-12-29 3/week @ 2023-01-05 6/week @ 2023-01-12 9/week @ 2023-01-19 6/week @ 2023-01-26 4/week @ 2023-02-02 2/week @ 2023-02-09 6/week @ 2023-02-16 30/week @ 2023-03-02 43/week @ 2023-03-09 44/week @ 2023-03-16 18/week @ 2023-03-23

135 downloads per month

MIT license

9KB
156 lines

This crate is a indented_text_writer type allowing you to append anything that satisfies the ToBytes trait to it. This includes things such as string slices, owned strings, byte slices, and characters for example.

like : C#

Example

write code:

#[cfg(test)]
use super::IndentedTextWriter;

fn main() {
    let mut writer = IndentedTextWriter::new("    ",1024, '{', '}');
    writer.write_line("struct Data {");
    writer.write_line("name: String,");
    writer.write_line("value: i32");
    writer.write_line("}");
    println!("{}",writer.string().unwrap());
}

Result:

struct Data {
    name: String,
    value: i32
}

forked by https://github.com/gsquire/string-builder

License

MIT

No runtime deps