Expand description
Generic base-N encoding/decoding with compile-time dictionaries.
Provides a unified interface for binary-to-text encodings (hex, base64, base32) with optimized runtime implementations and const-friendly fallbacks.
§Features
- Const evaluation: All encoding/decoding logic works in const contexts
- Zero-copy iterators: Streaming encoders and decoders with exact size hints
- Optimized paths: Hand-tuned implementations for Base64/Base32
- Flexible dictionaries: Support for custom alphabets and padding schemes
- Stack allocation: Fixed-size
ArrayStrandArraywrappers
§Submodules
hex: Hexadecimal encoding with upper/lowercase supportbase64: Standard and URL-safe Base64 encodingsbase64_url: URL-safe Base64 encodingsbase32: RFC 4648 Base32, Base32-Hex, and Base32-DNS variantsbase32_hex: RFC 4648 Base32-Hexbase32_dns: RFC 4648 Base32-DNS
§Examples
use omp_core::{base64, hex};
// Hex encoding
let encoded = hex::encode(b"Hello").into_string();
assert_eq!(encoded, "48656c6c6f");
// Base64 encoding
let encoded = base64::encode(b"Hello").into_string();
assert_eq!(encoded, "SGVsbG8=");
// Const evaluation
const HEX: hex::ArrayStr<5> = hex::encode_n(b"Hello");
assert_eq!(&*HEX, "48656c6c6f");Modules§
- base32
- base32 encoding and decoding.
- base64
- base64 encoding and decoding.
- base32_
dns - base32_dns encoding and decoding.
- base32_
hex - base32_hex encoding and decoding.
- base64_
url - base64_url encoding and decoding.
- hex
- Hexadecimal encoding and decoding with streaming support.
Structs§
- Array
- A byte array wrapper that derefs to the decoded portion.
- Array
Str - An encoded string wrapper that stores the result.
- Decode
Writer - A buffered writer that decodes encoded bytes before writing them to an inner writer.
- Decoder
- A streaming base-N decoder that converts encoded characters to bytes.
- Encode
Writer - A buffered writer that encodes raw bytes before writing them to an inner writer.
- Encoder
- Iterator that encodes bytes as individual base-N ASCII characters.
- Encoding
- A compile-time dictionary for base-N encoding/decoding.
Enums§
- Decode
Error - Errors that can occur during base-N encoding/decoding operations.
Type Aliases§
- Result
- Result type for base-N operations.