#string #utf-8 #algorithm

no-std enrede

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

2 releases

0.1.1 May 28, 2024
0.1.0 May 25, 2024

#983 in Encoding

Download history 166/week @ 2024-05-20 183/week @ 2024-05-27

349 downloads per month

MIT/Apache

91KB
2K SLoC

Enrede

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


lib.rs:

A crate for working with strings in encodings beyond UTF-8. The API is designed to match std's strings in most cases, so 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.

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.

TODO

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
    • Encodings with no invalid byte sequences
  • More encodings
    • Shift-JIS
    • Big5
    • ISO/IEC 8859-1

Dependencies

~0.5–1MB
~21K SLoC