Crates.io | newline-converter |
lib.rs | newline-converter |
version | 0.3.0 |
source | src |
created_at | 2020-06-07 08:46:32.071489 |
updated_at | 2023-03-23 22:53:09.955923 |
description | Newline byte converter library |
homepage | |
repository | https://github.com/spitfire05/rnc/tree/master/crates/newline-converter |
max_upload_size | |
id | 250908 |
size | 16,390 |
newline-converter
is a simple library used for converting the newline characters in strings between Windows \r\n
and Unix \n
style. It mainly serves as a backend for Rust Newline converter CLI tool.
\r
characters. For example, \r\n
sequences won't become \r\r\n
after unix2dos
call:
use newline_converter::unix2dos;
assert_eq!(
unix2dos("\nfoo\r\nbar\n"),
"\r\nfoo\rbar\n"
);
unix2dos
) when dealing with larger data sets (ex. 100 paragraphs of Lorem Ipsum).string.replace
unix2dos
.Regex::replace_all
unix2dos
, because of lack of support for look around.Regex::replace_all
unix2dos
has worst performance of all implementations, by an order of magnitude (because of look around used).Look into benches/bench.rs
for the comparision benchmarks.
Minimum Supported Rust Version is 1.38.0
.