Macro encrust::encrust

source ·
encrust!() { /* proc-macro */ }
Available on crate feature macros only.
Expand description

Encrust a literal value so the actual data is encrypted before being included in the binary.

Currently integers, strings and arrays of (arrays of) integers and strings are accepted.

Integers require their data type suffixed (-1i8, 127u16 etc).

Examples

let mut num = encrust!(0u8);
assert_eq!(0u8, *num.decrust());
let mut string = encrust!("This is a string");
assert_eq!("This is a string", string.decrust().as_str());
let mut array = encrust!([1i32, 2i32, 3i32]);
assert_eq!(&[1i32, 2i32, 3i32], array.decrust().as_slice());