mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-26 23:21:30 +11:00
17 lines
337 B
Rust
17 lines
337 B
Rust
|
use std::ops::BitAnd;
|
||
|
|
||
|
use winapi::ctypes::wchar_t;
|
||
|
|
||
|
pub fn has_flag<T>(bitset: T, flag: T) -> bool
|
||
|
where T:
|
||
|
Copy + PartialEq + BitAnd<T, Output = T>
|
||
|
{
|
||
|
bitset & flag == flag
|
||
|
}
|
||
|
|
||
|
pub fn wchar_to_string(wchar: &[wchar_t]) -> String {
|
||
|
String::from_utf16_lossy(wchar)
|
||
|
.trim_right_matches(0 as char)
|
||
|
.to_string()
|
||
|
}
|