[][src]Crate utf16_literal

This crate provides the utf16! macro, that takes a string literal and produces a &[u16; N] containing the UTF-16 encoded version of that string.

#![feature(proc_macro_hygiene)]	// Needed to use the macro in an expression
extern crate utf16_literal;

let v = utf16_literal::utf16!("Foo\u{1234}😀");
assert_eq!(v[0], 'F' as u16);
assert_eq!(v[1], 'o' as u16);
assert_eq!(v[2], 'o' as u16);
assert_eq!(v[3], 0x1234);
assert_eq!(v[4], 0xD83D);
assert_eq!(v[5], 0xDE00);
assert_eq!(v.len(), 6);



Emit a UTF-16 encoded string as a &[u16; N]