pub fn line_wrap<L: LineEnding>(
buf: &mut [u8],
input_len: usize,
line_len: usize,
line_ending: &L
) -> usizeExpand description
Insert line endings into the input.
Endings are inserted after each complete line, except the last line, even if the last line takes up the full line width.
bufmust be large enough to handle the increased size after endings are inserted. In other words,buf.len() >= input_len / line_len * line_ending.len().input_lenis the length of the unwrapped inbuf.line_lenis the desired line width without line ending characters.
Returns the number of line ending bytes added.
Panics
- When
line_ending.len() == 0 - When
bufis too small to contain the original input and its new line endings