pub fn print_write_items(write_items: impl Iterator<Item = WriteItem>, options: PrintWriteItemsOptions) -> String {
    // todo: faster string manipulation? or is this as good as it gets?
    let mut final_string = String::new();
    let indent_string = if options.use_tabs { String::from("\t") } else { " ".repeat(options.indent_width as usize) };

    for item in write_items.into_iter() {
        match item {
            WriteItem::Indent(times) => final_string.push_str(&indent_string.repeat(times as usize)),
            WriteItem::NewLine => final_string.push_str(&options.new_line_text),
            WriteItem::Tab => final_string.push_str("\t"),
            WriteItem::Space => final_string.push_str(" "),
            WriteItem::String(text) => final_string.push_str(&text.text),
        }
    }

    final_string
}
/// Prints string based writer items.
Prints string based writer items.
Prints string based writer items .
pub fn print_write_items(write_items: impl Iterator<Item = WriteItem>, options: PrintWriteItemsOptions) -> String {
    // todo: faster string manipulation? or is this as good as it gets?
    let mut final_string = String::new();
    let indent_string = if options.use_tabs { String::from("\t") } else { " ".repeat(options.indent_width as usize) };
    for item in write_items.into_iter() {
        match item {
            WriteItem::Indent(times) => final_string.push_str(&indent_string.repeat(times as usize)),
            WriteItem::NewLine => final_string.push_str(&options.new_line_text),
            WriteItem::Tab => final_string.push_str("\t"),
            WriteItem::Space => final_string.push_str(" "),
            WriteItem::String(text) => final_string.push_str(&text.text),
        }
    }
    final_string
}
pub fn print_write_items ( write_items : impl Iterator < Item = WriteItem > , options : PrintWriteItemsOptions ) -> String { // todo: faster string manipulation? or is this as good as it gets? let mut final_string = String :: new ( ) ; let indent_string = if options . use_tabs { String :: from ( " \t " ) } else { " " . repeat ( options . indent_width as usize ) } ; for item in write_items . into_iter ( ) { match item { WriteItem :: Indent ( times ) => final_string . push_str ( & indent_string . repeat ( times as usize ) ) , WriteItem :: NewLine => final_string . push_str ( & options . new_line_text ) , WriteItem :: Tab => final_string . push_str ( " \t " ) , WriteItem :: Space => final_string . push_str ( " " ) , WriteItem :: String ( text ) => final_string . push_str ( & text . text ) , } } final_string }
Prints string based writer items.
Prints string based writer items .
write_items
impl Iterator<Item = WriteItem>
options
PrintWriteItemsOptions
write_items
impl Iterator<Item = WriteItem>
options
PrintWriteItemsOptions