#string-encoding #utf-8 #utf-8-string #algorithm #string-algorithm

no-std enrede

An easy-to-use string encoding library, providing an interface similar to str/String

5 releases

0.2.0 Jun 18, 2025
0.1.3 Aug 9, 2024
0.1.2 Aug 9, 2024
0.1.1 May 28, 2024
0.1.0 May 25, 2024

#856 in Encoding

Download history 1018/week @ 2025-10-05 942/week @ 2025-10-12 976/week @ 2025-10-19 850/week @ 2025-10-26 752/week @ 2025-11-02 726/week @ 2025-11-09 708/week @ 2025-11-16 672/week @ 2025-11-23 743/week @ 2025-11-30 599/week @ 2025-12-07 405/week @ 2025-12-14 341/week @ 2025-12-21 210/week @ 2025-12-28 1686/week @ 2026-01-04 1086/week @ 2026-01-11 366/week @ 2026-01-18

3,412 downloads per month
Used in 3 crates (via jxoesneon-tectonic-xetex_…)

MIT/Apache

430KB
12K SLoC

Enrede

Crates.io Version Crates.io License Actions Badge

An easy-to-use string encoding library, providing an interface similar to str/String, for working with strings in encodings beyond UTF-8. Due to the API being based on std, working with other encodings is as transparent and painless as possible.

The name, enrede, is a double wordplay - Encode/Recode/Decode, and Enrede means 'tangled' or 'caught' in Spanish.

Features

  • Str<E> and String<E> types, equivalent to str and std::string::String, but generic over encoding.
  • CStr<E> and CString<E> types, equivalent to std::ffi::CStr and std::ffi::CString, but generic over encoding.
  • Encoding trait with support for lower-level direct encoding/recoding into slices
  • no_std support
  • rand::Distribution impls for encodings, allowing easy generation of valid characters for an encoding

Planned Features

These features are not yet supported, but are planned for a future version:

  • Dynamically encoded strings
  • Extended methods for encodings following certain properties:
    • Constant length encodings
  • More encodings
    • Big5
  • More methods on strings and C-strings

no_std Support

By default, the std and alloc features are enabled. By using default-features = false in your Cargo.toml, you can disable these features. When std is disabled, this crate is no_std. When the alloc feature is disabled, the crate won't use alloc, and any types or functions requiring allocation will be disabled (For example String<E>).

Limitations

Currently, it is assumed that all supported encodings are subsets of the Unicode character set.

Dependencies

~0.8–1.3MB
~27K SLoC