[][src]Macro real_c_string::real_c_wstring

real_c_wstring!() { /* proc-macro */ }

Same as real_c_string, but used for wchar_t* strings

#![feature(proc_macro_hygiene)]

use real_c_string::real_c_wstring;
assert_eq!(0i16, unsafe{*real_c_wstring!("")});

let c_wstring = real_c_wstring!("Hello world!");
let same_as_array_of_bytes: [i16;13] = [72i16, 101i16, 108i16, 108i16, 111i16, 32i16, 119i16, 111i16, 114i16, 108i16, 100i16, 33i16, 0i16];
for i in 0..13 {
    assert_eq!(same_as_array_of_bytes[i], unsafe{*c_wstring.offset(i as isize)})
}

let c_wstring = real_c_wstring!("Привет world!");
let same_as_array_of_bytes: [i16;14] = [1055i16, 1088i16, 1080i16, 1074i16, 1077i16, 1090i16, 32i16, 119i16, 111i16, 114i16, 108i16, 100i16, 33i16, 0i16];
for i in 0..13 {
    assert_eq!(same_as_array_of_bytes[i], unsafe{*c_wstring.offset(i as isize)})
}