Skip to main content

nwnrs_encoding/
lib.rs

1#![forbid(unsafe_code)]
2#![doc = "# nwnrs-encoding\n\n`nwnrs-encoding` is the workspace policy boundary for text encoding.\n\n## Why This Crate Exists\n\nNWN stores text in a non-UTF-8 encoding that varies by platform and language.\nWithout a central policy boundary, every format crate would embed its own\nencoding assumptions and diverge silently. This crate makes the workspace\nencoding policy explicit and gives all format crates a single place to\ntranscode NWN byte storage to and from Rust `String` values.\n\n## Scope\n\n- define the default NWN text encoding\n- detect host-native encoding when needed\n- expose conversion routines between NWN byte storage and Rust `String` values\n- make encoding policy explicit instead of scattering it across format crates\n\nThe central operations are [`to_nwnrs_encoding`], [`from_nwnrs_encoding`],\n[`to_native_encoding`], and [`from_native_encoding`].\n\n## Public Surface\n\n- provide a complete transcoding framework for arbitrary encodings\n- own higher-level localization semantics\n\n## See also\n\n- [`nwnrs-localization`](https://docs.rs/nwnrs-localization), which defines\n  the language and string-reference vocabulary built on top of this encoding\n  layer\n"include_str!("../README.md")]
3
4mod encoding;
5mod errors;
6
7pub use encoding::*;
8pub use errors::*;
9
10/// Common imports for consumers of this crate.
11pub mod prelude {
12    pub use crate::{
13        EncodingConversionError, NativeEncodingError, UnknownEncodingError, clear_native_encoding,
14        detect_system_native_encoding, from_native_encoding, from_nwnrs_encoding,
15        get_native_encoding, get_native_encoding_name, get_nwnrs_encoding, get_nwnrs_encoding_name,
16        set_native_encoding, set_nwnrs_encoding, to_native_encoding, to_nwnrs_encoding,
17    };
18}