Crate wchar[][src]

A procedural macro for compile time UTF-16 strings.

This crate introduces a macro wch! to create UTF-16 wide strings at compiler time, like the L literal in C.

In order to use the macro the proc_macro and proc_macro_non_items features must be enabled.

Examples

#![feature(proc_macro, proc_macro_non_items)]

extern crate wchar;

use wchar::wch;

// Equivalent to `#define RUST L"Rust"` in C.
const RUST: &[u16] = wch!("Rust\0"); // C strings are null-terminated.

assert_eq!(WIDE_RUST, &[0x0052, 0x0075, 0x0073, 0x0074, 0x0000]);

Functions

wch

Generate a UTF-16 wide string from the given string literal.