/
View dependency graph
Depends on
- dh-cargo (dh-sequence-cargo)
- cargo, debhelper-compat, librust-unicode-segmentation-1+default-dev, libstd-rust-dev, rustc
README (full)
newline-converter
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.
Comparision of newline-wrangling methods
newline-converter (this crate)
- ✅ Properly handles edge-cases like lone
\rcharacters. For example,\r\nsequences won't become\r\r\nafterunix2doscall:use newline_converter::unix2dos; assert_eq!( unix2dos("\nfoo\r\nbar\n"), "\r\nfoo\rbar\n" ); - ✅ Is the fastest when input data is small (few bytes of text with line breaks).
- ❌ Is the slowest (or second slowest in case of
unix2dos) when dealing with larger data sets (ex. 100 paragraphs of Lorem Ipsum).
string.replace
- ❌ Does not handle edge cases properly in
unix2dos. - ✅ Good performance on larger data sets.
regex crate Regex::replace_all
- ❌ Does not handle edge cases properly in
unix2dos, because of lack of support for look around. - ✅ The best performance with larger data sets.
fancy-regex crate Regex::replace_all
- ✅ Properly handles edge cases.
- ❌
unix2doshas worst performance of all implementations, by an order of magnitude (because of look around used).
Look into benches/bench.rs for the comparision benchmarks.
MSRV
Minimum Supported Rust Version is 1.38.0.
| dir | benches/ |
| dir | debian/ |
| dir | src/ |
| file | .cargo_vcs_info.json |
| file | .gitignore |
| file | Cargo.toml |
| file | Cargo.toml.orig |
| file | README.md |
| file | changelog.md |