#time #utf-16

macro wchar-impl

Internal implementation of wchar

6 releases (breaking)

0.11.0 Aug 9, 2021
0.10.0 May 14, 2021
0.9.0 May 12, 2021
0.8.0 May 5, 2021
0.5.0 Jul 22, 2019

#32 in #utf-16

Download history 2545/week @ 2024-07-22 3419/week @ 2024-07-29 2965/week @ 2024-08-05 2425/week @ 2024-08-12 3066/week @ 2024-08-19 4145/week @ 2024-08-26 3260/week @ 2024-09-02 3539/week @ 2024-09-09 2999/week @ 2024-09-16 3825/week @ 2024-09-23 2653/week @ 2024-09-30 3146/week @ 2024-10-07 4600/week @ 2024-10-14 2823/week @ 2024-10-21 3399/week @ 2024-10-28 4606/week @ 2024-11-04

15,468 downloads per month
Used in 8 crates (via wchar)

MIT/Apache

12KB
308 lines

wchar

build status crates.io docs.rs

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

[dependencies]
wchar = "0.10"

Compiler support: requires rustc 1.53+

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);

License

This project is licensed under either of Apache License, Version 2.0 or MIT License at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~1.5MB
~36K SLoC