Skip to main content

encode

Macro encode 

Source
macro_rules! encode {
    ($bytes:expr) => { ... };
    ($bytes:expr, $uppercase:expr) => { ... };
}
Expand description

Helper macro for encoding hexadecimal string in const contexts.

ยงExamples

const HELLO_WORLD_LOWERCASE: &str = fashex::encode!(b"Hello, world!");
assert_eq!(HELLO_WORLD_LOWERCASE, "48656c6c6f2c20776f726c6421");
const HELLO_WORLD_UPPERCASE: &str = fashex::encode!(b"Hello, world!", true);
assert_eq!(HELLO_WORLD_UPPERCASE, "48656C6C6F2C20776F726C6421");