diff --git a/src/windows/com.rs b/src/windows/com.rs index be9f13ff..0391b5af 100644 --- a/src/windows/com.rs +++ b/src/windows/com.rs @@ -5,7 +5,6 @@ // All files in the project carrying such notice may not be copied, modified, or distributed // except according to those terms. -#![allow(unused)] use crate::windows::{ winapi::{IUnknown, Interface}, windows_sys::{ @@ -15,9 +14,9 @@ use crate::windows::{ }; use std::{ convert::TryInto, - ffi::{OsStr, OsString}, + ffi::OsString, ops::Deref, - os::windows::ffi::{OsStrExt, OsStringExt}, + os::windows::ffi::OsStringExt, ptr::{null, null_mut}, slice::from_raw_parts, }; @@ -109,34 +108,3 @@ impl Drop for BStr { unsafe { SysFreeString(self.0) }; } } - -pub trait ToWide { - fn to_wide(&self) -> Vec; - fn to_wide_null(&self) -> Vec; -} -impl ToWide for T -where - T: AsRef, -{ - fn to_wide(&self) -> Vec { - self.as_ref().encode_wide().collect() - } - fn to_wide_null(&self) -> Vec { - self.as_ref().encode_wide().chain(Some(0)).collect() - } -} -pub trait FromWide -where - Self: Sized, -{ - fn from_wide(wide: &[u16]) -> Self; - fn from_wide_null(wide: &[u16]) -> Self { - let len = wide.iter().take_while(|&&c| c != 0).count(); - Self::from_wide(&wide[..len]) - } -} -impl FromWide for OsString { - fn from_wide(wide: &[u16]) -> OsString { - OsStringExt::from_wide(wide) - } -}