Skip to main content

bluetape_rs_codec/
lib.rs

1//! Codec and encoding helpers for bluetape-rs.
2//!
3//! This crate is part of the `0.3.1` workspace release. It provides strict hexadecimal
4//! encoding and decoding plus focused Base64, Base58, and Base62 helpers, then
5//! grows into additional binary/text helpers in follow-up issues.
6//!
7//! Planned APIs stay small and Rust-native:
8//!
9//! - strict hex encoding and decoding
10//! - Base64 standard and URL-safe variants
11//! - Base58 and byte-oriented Base62 variants
12//! - typed errors for caller-owned invalid encoded input
13//! - UTF-8 text/byte boundary helpers for codec call sites
14//!
15//! Compression belongs to `0.4.0`, and serde-oriented serialization belongs to
16//! `0.5.0`. This crate does not provide those APIs.
17//!
18//! ```text
19//! // Enable the root facade when a single dependency is more convenient:
20//! // bluetape-rs = { version = "0.3.1", features = ["codec"] }
21//! ```
22
23mod base58;
24mod base62;
25mod base64;
26mod base_n;
27mod hex;
28mod text;
29
30pub use base58::{Base58DecodeError, decode_base58, encode_base58};
31pub use base62::{Base62DecodeError, decode_base62, encode_base62};
32pub use base64::{
33    Base64DecodeError, decode_base64, decode_base64_unpadded, decode_base64_url,
34    decode_base64_url_unpadded, encode_base64, encode_base64_unpadded, encode_base64_url,
35    encode_base64_url_unpadded,
36};
37pub use hex::{HexDecodeError, decode_hex, encode_hex_lower, encode_hex_upper};
38pub use text::{TextDecodeError, decode_utf8_text, decode_utf8_text_lossy, encode_utf8_text};
39
40#[cfg(test)]
41mod tests {
42    #[test]
43    fn crate_metadata_matches_codec_boundary() {
44        assert_eq!(env!("CARGO_PKG_NAME"), "bluetape-rs-codec");
45        assert_eq!(env!("CARGO_PKG_VERSION"), "0.3.1");
46    }
47}