| Crates.io | normalized-line-endings |
| lib.rs | normalized-line-endings |
| version | 1.0.14 |
| created_at | 2025-05-19 18:09:50.342016+00 |
| updated_at | 2026-01-15 18:23:47.996711+00 |
| description | Line endings normalizer |
| homepage | https://engossoftware.github.io/normalized-line-endings/ |
| repository | https://github.com/EngosSoftware/normalized-line-endings.git |
| max_upload_size | |
| id | 1680192 |
| size | 39,095 |
This crate provides an iterator over characters with normalized line endings,
meaning all valid line endings in the input are converted to a single newline
character: \n (U+000A), like this:
\n → \n\r → \n\r\n → \nThe normalized iterator can be created using standalone function normalized
or by calling the method normalized on any iterator over characters.
use normalized_line_endings::normalized;
fn using_standalone_function_should_work() {
let input = "This is a string \n with \r some \n\r\n random newlines\r\r\n\n";
assert_eq!(
"This is a string \n with \n some \n\n random newlines\n\n\n",
normalized(input.chars()).collect::<String>()
);
}
use normalized_line_endings::Normalized;
fn using_trait_extension_should_work() {
let input = "This is a string \n with \r some \n\r\n random newlines\r\r\n\n";
assert_eq!(
"This is a string \n with \n some \n\n random newlines\n\n\n",
input.chars().normalized().collect::<String>()
);
}
Licensed under either of
at your option.
Any contributions to normalized-line-endings are greatly appreciated. All contributions intentionally submitted for inclusion in the work by you, shall be dual licensed as above, without any additional terms or conditions.