Crates.io | mangling |
lib.rs | mangling |
version | 0.2.4 |
source | src |
created_at | 2020-04-10 20:38:34.264061 |
updated_at | 2024-08-31 17:55:26.485928 |
description | mangling generates safe, recognizable identifiers from byte streams. |
homepage | |
repository | https://github.com/kulp/mangling |
max_upload_size | |
id | 228462 |
size | 39,238 |
This library provides for reversibly generating identifiers (hereinafter "mangled names") that are valid under C-language rules, from arbitrary byte streams, while maintaining a measure of human readability.
See lib.rs
for examples of strings with their manglings.
The functionality of mangling
was hoisted out of a compiler that needed to translate identifiers for Java symbols (e.g. method names and signatures) into symbols valid for the generated assembly language. Although the mangling process can encode any stream of bytes into a (longer) string of ASCII characters, and then convert the output back again, it is not intended to provide general encoding/decoding facilities. Instead, it is meant to provide an easy, reliable way for compiler writers to generate human-recognizable identifiers without having to invent their own mangling scheme.
At present, only one mangling scheme is supported, with a fixed format defined in the library documentation. The mangling scheme is simple, and may not be original, but is not known to be shared with any other system, so no interoperability guarantees are provided. Future revisions may change the API to allow some level of configurability or replacement of the encoding scheme.
The minimum supported Rust version is documented in Cargo.toml
via the rust-version
key. The MSRV for mangling
may change at any time, but usually for good reasons.
Any demonstrated failure of mangling
to meet its stated requirements should be reported through Github, and pull requests are welcomed.