Crate wchar[−][src]
Expand description
This library introduces two macros wch
and wchz
to create UTF-16 or
UTF-32 wide strings at compiler time, like L
string literals in C.
Example
use wchar::{wch, wchz, wchar_t}; // Equivalent to `#define RUST L"Rust"` in C. const RUST: &[wchar_t] = wch!("Rust\0"); // C strings are nul-terminated. // Equivalent to `#define ALSO_RUST L"Rust"` in C. const ALSO_RUST: &[wchar_t] = wchz!("Rust"); assert_eq!(RUST, &['R' as wchar_t, 'u' as wchar_t, 's' as wchar_t, 't' as wchar_t, 0x0000]); assert_eq!(RUST, ALSO_RUST);
Macros
Generate a UTF-16 or UTF-32 wide string from a UTF-8 encoded file.
Generate a UTF-16 or UTF-32 wide string from a UTF-8 encoded file.
Generate a UTF-16 or UTF-32 wide string from a string literal.
Generate a C-style nul-terminated UTF-16 or UTF-32 wide string from a string literal.
Type Definitions
Platform wide character type.