Crate wchar[][src]

This library introduces two macros wch and wch_c to create UTF-16 or UTF-32 wide strings at compiler time, like L string literals in C.

Example

use wchar::{wch, wch_c};

// Equivalent to `#define RUST L"Rust"` in C.
const RUST: &[u16] = wch!("Rust\0"); // C strings are nul-terminated.
assert_eq!(RUST, &[0x0052, 0x0075, 0x0073, 0x0074, 0x0000]);

// Equivalent to `#define ALSO_RUST L"Rust"` in C.
const ALSO_RUST: &[u16] = wch_c!("Rust");
assert_eq!(ALSO_RUST, &[0x0052, 0x0075, 0x0073, 0x0074, 0x0000]);

Macros

wch

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

wch_c

Generate a C-style nul-terminated UTF-16 or UTF-32 wide string from the given string literal.