-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the code from
lib.rs
to separate files
- Loading branch information
Showing
8 changed files
with
1,049 additions
and
1,014 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2023, Igor Shaula | ||
// Licensed under the MIT License <LICENSE or | ||
// http://opensource.org/licenses/MIT>. This file | ||
// may not be copied, modified, or distributed | ||
// except according to those terms. | ||
#![macro_use] | ||
use std::ffi::OsStr; | ||
use std::os::windows::ffi::OsStrExt; | ||
use std::slice; | ||
|
||
macro_rules! werr { | ||
($e:expr) => { | ||
Err(io::Error::from_raw_os_error($e as i32)) | ||
}; | ||
} | ||
|
||
pub(crate) fn to_utf16<P: AsRef<OsStr>>(s: P) -> Vec<u16> { | ||
s.as_ref() | ||
.encode_wide() | ||
.chain(Some(0).into_iter()) | ||
.collect() | ||
} | ||
|
||
pub(crate) fn v16_to_v8(v: &[u16]) -> Vec<u8> { | ||
unsafe { slice::from_raw_parts(v.as_ptr() as *const u8, v.len() * 2).to_vec() } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.