use-line 0.1.0

Composable line-level text primitives for RustUse.
Documentation
  • Coverage
  • 100%
    23 out of 23 items documented1 out of 16 items with examples
  • Size
  • Source code size: 9.89 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 524.56 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-text
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-line

Composable line-level text primitives for RustUse.

use-line provides small helpers for line counting, indentation, dedentation, and line-ending normalization. It stays explicit about logical lines and keeps the behavior predictable across LF, CRLF, and CR inputs.

Included primitives

  • line_count
  • non_empty_line_count
  • trim_lines
  • normalize_line_endings
  • indent_lines
  • dedent_lines
  • lines_with_numbers

Example

use use_line::{dedent_lines, line_count, lines_with_numbers, LineEnding};

assert_eq!(line_count("alpha\nbeta\n"), 2);
assert_eq!(dedent_lines("    alpha\n      beta"), "alpha\n  beta");
assert_eq!(lines_with_numbers("alpha")[0].number.get(), 1);
assert_eq!(LineEnding::Crlf.as_str(), "\r\n");