try_bin

Macro try_bin 

Source
macro_rules! try_bin {
    ($x:literal) => { ... };
}
Expand description

Macro for creating a ByteArray from a binary string literal (without 0b prefix).

§CAVEAT

This macro always interprets the input as binary. It does not perform UTF-8 conversion. If you need automatic format detection with UTF-8 fallback, use try_bytes! instead.

§Examples

use byte_array_ops::try_bin;

let bin = try_bin!("11110000").unwrap();
assert_eq!(bin.as_bytes(), [0xf0]);