indented_text_writer

Crates.ioindented_text_writer
lib.rsindented_text_writer
version0.4.0
sourcesrc
created_at2022-11-25 07:14:59.776415
updated_at2024-01-24 14:36:05.14345
descriptionA simple IndentedTextWriter
homepage
repositoryhttps://github.com/taiyoungjang/rs_indented_text_writer
max_upload_size
id722602
size11,156
Taiyoung Jang (taiyoungjang)

documentation

https://docs.rs/indented_text_writer

README

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 is_lf = true;
    let mut writer = IndentedTextWriter::new("    ",1024, '{', '}', is_lf);
    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

Commit count: 7

cargo fmt