Debian Codegraph @

.cargo/vendor/widestring/src/platform/other.rs

raw
1 use std::ffi::{OsStr, OsString};
2
3 pub(crate) fn os_to_wide(s: &OsStr) -> Vec<u16> {
4 s.to_string_lossy().encode_utf16().collect()
5 }
6
7 pub(crate) fn os_from_wide(s: &[u16]) -> OsString {
8 OsString::from(String::from_utf16_lossy(s))
9 }