wright/util/
supports_unicode.rs1#[cfg(feature = "supports-unicode")]
5use ::supports_unicode as supports_unicode_crate;
6
7#[cfg(feature = "supports-unicode")]
8use core::sync::atomic::AtomicBool;
9
10#[cfg(feature = "supports-unicode")]
12pub static FORCE_ASCII: AtomicBool = AtomicBool::new(false);
13
14#[cfg(feature = "supports-unicode")]
16pub fn set_force_ascii(force_ascii: bool) {
17 use core::sync::atomic::Ordering;
18
19 FORCE_ASCII.store(force_ascii, Ordering::Release);
20}
21
22pub fn supports_unicode() -> bool {
24 #[cfg(feature = "supports-unicode")]
25 {
26 use core::sync::atomic::Ordering;
27
28 !FORCE_ASCII.load(Ordering::Acquire) && supports_unicode_crate::supports_unicode()
29 }
30
31 #[cfg(not(feature = "supports-unicode"))]
32 {
33 false
34 }
35}