Skip to main content

nonempty_bytes

Macro nonempty_bytes 

Source
macro_rules! nonempty_bytes {
    ($value:expr) => { ... };
}
Expand description

A NonEmpty<&'static [u8]> checked at compile time.

The byte-string twin of nonempty! — the Context derivation APIs are byte-oriented, so a domain tag that is naturally a byte string deserves the same compile-time path as a &str one, instead of a runtime NonEmpty::new(b"tag".as_slice()).unwrap().

use vitaminc_protected::{nonempty_bytes, NonEmpty};

let context: NonEmpty<&'static [u8]> = nonempty_bytes!(b"users/email");
assert_eq!(context.get(), &b"users/email".as_slice());
let context = vitaminc_protected::nonempty_bytes!(b"");