rawstring

Crates.iorawstring
lib.rsrawstring
version0.1.2
created_at2025-11-05 17:18:23.776093+00
updated_at2025-11-05 19:18:57.87843+00
descriptionA string type that can hold data which may or may not be valid UTF-8.
homepage
repositoryhttps://github.com/imaybnero/rawstring
max_upload_size
id1918281
size15,113
(imnerolin)

documentation

README

rawstring provides a string type that can hold data that may or not be valid UTF-8.

Overview

Rust's standard [String] and &str types require valid UTF-8, which can be limiting when working with arbitrary binary data. This crate provides the following types as alternatives:

  • [RawStr]: a borrowed view of raw string data
  • [RawString]: an owned raw string type

[RawStr] and [RawString] differ from &[u8] and Vec<u8> in that they are treated as text rather than binary data. For example, both types' [Debug] and [Display] implementations handle invalid UTF-8 gracefully by replacing invalid sequences with the Unicode replacement character (). This makes them suitable for logging, user output, and other contexts where human-readable text is desired.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Commit count: 0

cargo fmt