| 1 |
use cstr::cstr; |
| 2 |
use std::ffi::CStr; |
| 3 |
|
| 4 |
const FOO: &CStr = cstr!(b"foo\xffbar"); |
| 5 |
static BAR: &CStr = cstr!("bar"); |
| 6 |
|
| 7 |
fn main() { |
| 8 |
assert_eq!(FOO, CStr::from_bytes_with_nul(b"foo\xffbar\0").unwrap()); |
| 9 |
assert_eq!(BAR, CStr::from_bytes_with_nul(b"bar\0").unwrap()); |
| 10 |
} |