5
5
// All files in the project carrying such notice may not be copied, modified, or distributed
6
6
// except according to those terms.
7
7
8
- #![ allow( unused) ]
9
-
10
8
use crate :: windows:: {
11
9
winapi:: { IUnknown , Interface } ,
12
10
windows_sys:: {
@@ -16,10 +14,9 @@ use crate::windows::{
16
14
} ;
17
15
use std:: {
18
16
convert:: TryInto ,
19
- ffi:: { OsStr , OsString } ,
20
- mem:: ManuallyDrop ,
17
+ ffi:: OsString ,
21
18
ops:: Deref ,
22
- os:: windows:: ffi:: { OsStrExt , OsStringExt } ,
19
+ os:: windows:: ffi:: OsStringExt ,
23
20
ptr:: { null, null_mut} ,
24
21
slice:: from_raw_parts,
25
22
} ;
48
45
assert ! ( !ptr. is_null( ) ) ;
49
46
ComPtr ( ptr)
50
47
}
51
- /// Casts up the inheritance chain
52
- pub fn up < U > ( self ) -> ComPtr < U >
53
- where
54
- T : Deref < Target = U > ,
55
- U : Interface ,
56
- {
57
- ComPtr ( self . into_raw ( ) as * mut U )
58
- }
59
- /// Extracts the raw pointer.
60
- /// You are now responsible for releasing it yourself.
61
- pub fn into_raw ( self ) -> * mut T {
62
- ManuallyDrop :: new ( self ) . 0
63
- }
64
48
/// For internal use only.
65
49
fn as_unknown ( & self ) -> & IUnknown {
66
50
unsafe { & * ( self . 0 as * mut IUnknown ) }
@@ -124,34 +108,3 @@ impl Drop for BStr {
124
108
unsafe { SysFreeString ( self . 0 ) } ;
125
109
}
126
110
}
127
-
128
- pub trait ToWide {
129
- fn to_wide ( & self ) -> Vec < u16 > ;
130
- fn to_wide_null ( & self ) -> Vec < u16 > ;
131
- }
132
- impl < T > ToWide for T
133
- where
134
- T : AsRef < OsStr > ,
135
- {
136
- fn to_wide ( & self ) -> Vec < u16 > {
137
- self . as_ref ( ) . encode_wide ( ) . collect ( )
138
- }
139
- fn to_wide_null ( & self ) -> Vec < u16 > {
140
- self . as_ref ( ) . encode_wide ( ) . chain ( Some ( 0 ) ) . collect ( )
141
- }
142
- }
143
- pub trait FromWide
144
- where
145
- Self : Sized ,
146
- {
147
- fn from_wide ( wide : & [ u16 ] ) -> Self ;
148
- fn from_wide_null ( wide : & [ u16 ] ) -> Self {
149
- let len = wide. iter ( ) . take_while ( |& & c| c != 0 ) . count ( ) ;
150
- Self :: from_wide ( & wide[ ..len] )
151
- }
152
- }
153
- impl FromWide for OsString {
154
- fn from_wide ( wide : & [ u16 ] ) -> OsString {
155
- OsStringExt :: from_wide ( wide)
156
- }
157
- }
0 commit comments