use-utf8 0.1.0

UTF-8 validation and truncation helpers for RustUse
Documentation
  • Coverage
  • 7.69%
    1 out of 13 items documented1 out of 10 items with examples
  • Size
  • Source code size: 5.24 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 338.45 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 33s Average build duration of successful builds.
  • all releases: 33s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • RustUse/use-encoding
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-utf8

UTF-8 validation, truncation, and string-statistics helpers.

Warning: versions below 0.3.0 are experimental and may change as the crate surface is refined.

Example Usage

use use_utf8::{truncate_utf8_bytes, utf8_lossy, utf8_stats};

let lossy = utf8_lossy(b"hi\xFF");
let truncated = truncate_utf8_bytes("cafe\u{301}", 5);
let stats = utf8_stats("rust");

let _ = (lossy, truncated, stats);

Scope

  • UTF-8 validity checks and lossy conversions
  • byte-safe truncation helpers that avoid splitting code points
  • lightweight string length and ASCII/statistics helpers

Non-Goals

  • grapheme segmentation
  • Unicode normalization
  • locale-specific behavior

License

Licensed under either of the following, at your option:

  • MIT License
  • Apache License, Version 2.0