[−][src]Crate linurgy
linurgy
provides an interface for manipulating multiple newlines in text.
Interaction with this library happens through
LinurgyBuilder
.
Examples
Read stdin and for each empty line, append an extra line to stdout.
LinurgyBuilder::new() .set_newline_trigger(1) .set_new_text("\n") .run();
Read from one buffer, remove all empty lines, and output to another buffer.
let input = String::from("Remove\n\nEvery\n\nEmpty\n\nLine\n"); let mut output = String::new(); LinurgyBuilder::new() .set_input(Input::Buffer(&input)) .set_output(Output::Buffer(&mut output)) .set_newline_trigger(1) .set_edit_type(EditType::Replace) .set_new_text("") .run(); assert_eq!("Remove\nEvery\nEmpty\nLine\n", &output);
Structs
LinurgyBuilder | Use this to prepare and execute linurgy editing on a stream. |
Enums
EditType | Which action to implement when editing newlines |
Input | Type of input stream to edit |
Output | Type of output stream to write edits to |