@@ -9,8 +9,8 @@ use std::os::windows::ffi::*;
9
9
use std:: os:: windows:: io:: * ;
10
10
use std:: time:: Duration ;
11
11
12
- use handle:: Handle ;
13
- use overlapped:: Overlapped ;
12
+ use crate :: handle:: Handle ;
13
+ use crate :: overlapped:: Overlapped ;
14
14
use winapi:: shared:: minwindef:: * ;
15
15
use winapi:: shared:: ntdef:: HANDLE ;
16
16
use winapi:: shared:: winerror:: * ;
@@ -54,7 +54,7 @@ pub struct NamedPipeBuilder {
54
54
pub fn anonymous ( buffer_size : u32 ) -> io:: Result < ( AnonRead , AnonWrite ) > {
55
55
let mut read = 0 as HANDLE ;
56
56
let mut write = 0 as HANDLE ;
57
- :: cvt ( unsafe { CreatePipe ( & mut read, & mut write, 0 as * mut _ , buffer_size) } ) ?;
57
+ crate :: cvt ( unsafe { CreatePipe ( & mut read, & mut write, 0 as * mut _ , buffer_size) } ) ?;
58
58
Ok ( ( AnonRead ( Handle :: new ( read) ) , AnonWrite ( Handle :: new ( write) ) ) )
59
59
}
60
60
@@ -181,8 +181,8 @@ impl NamedPipe {
181
181
182
182
fn _wait ( addr : & OsStr , timeout : Option < Duration > ) -> io:: Result < ( ) > {
183
183
let addr = addr. encode_wide ( ) . chain ( Some ( 0 ) ) . collect :: < Vec < _ > > ( ) ;
184
- let timeout = :: dur2ms ( timeout) ;
185
- :: cvt ( unsafe { WaitNamedPipeW ( addr. as_ptr ( ) , timeout) } ) . map ( |_| ( ) )
184
+ let timeout = crate :: dur2ms ( timeout) ;
185
+ crate :: cvt ( unsafe { WaitNamedPipeW ( addr. as_ptr ( ) , timeout) } ) . map ( |_| ( ) )
186
186
}
187
187
188
188
/// Connects this named pipe to a client, blocking until one becomes
@@ -192,7 +192,7 @@ impl NamedPipe {
192
192
/// client to connect. This can be called immediately after the pipe is
193
193
/// created, or after it has been disconnected from a previous client.
194
194
pub fn connect ( & self ) -> io:: Result < ( ) > {
195
- match :: cvt ( unsafe { ConnectNamedPipe ( self . 0 . raw ( ) , 0 as * mut _ ) } ) {
195
+ match crate :: cvt ( unsafe { ConnectNamedPipe ( self . 0 . raw ( ) , 0 as * mut _ ) } ) {
196
196
Ok ( _) => Ok ( ( ) ) ,
197
197
Err ( ref e) if e. raw_os_error ( ) == Some ( ERROR_PIPE_CONNECTED as i32 ) => Ok ( ( ) ) ,
198
198
Err ( e) => Err ( e) ,
@@ -219,7 +219,7 @@ impl NamedPipe {
219
219
/// valid until the I/O operation is completed, typically via completion
220
220
/// ports and waiting to receive the completion notification on the port.
221
221
pub unsafe fn connect_overlapped ( & self , overlapped : * mut OVERLAPPED ) -> io:: Result < bool > {
222
- match :: cvt ( ConnectNamedPipe ( self . 0 . raw ( ) , overlapped) ) {
222
+ match crate :: cvt ( ConnectNamedPipe ( self . 0 . raw ( ) , overlapped) ) {
223
223
Ok ( _) => Ok ( true ) ,
224
224
Err ( ref e) if e. raw_os_error ( ) == Some ( ERROR_PIPE_CONNECTED as i32 ) => Ok ( true ) ,
225
225
Err ( ref e) if e. raw_os_error ( ) == Some ( ERROR_IO_PENDING as i32 ) => Ok ( false ) ,
@@ -229,7 +229,7 @@ impl NamedPipe {
229
229
230
230
/// Disconnects this named pipe from any connected client.
231
231
pub fn disconnect ( & self ) -> io:: Result < ( ) > {
232
- :: cvt ( unsafe { DisconnectNamedPipe ( self . 0 . raw ( ) ) } ) . map ( |_| ( ) )
232
+ crate :: cvt ( unsafe { DisconnectNamedPipe ( self . 0 . raw ( ) ) } ) . map ( |_| ( ) )
233
233
}
234
234
235
235
/// Issues an overlapped read operation to occur on this pipe.
@@ -388,7 +388,7 @@ impl<'a> Write for &'a NamedPipe {
388
388
} )
389
389
}
390
390
fn flush ( & mut self ) -> io:: Result < ( ) > {
391
- :: cvt ( unsafe { FlushFileBuffers ( self . 0 . raw ( ) ) } ) . map ( |_| ( ) )
391
+ crate :: cvt ( unsafe { FlushFileBuffers ( self . 0 . raw ( ) ) } ) . map ( |_| ( ) )
392
392
}
393
393
}
394
394
@@ -528,8 +528,8 @@ mod tests {
528
528
use rand:: { thread_rng, Rng } ;
529
529
530
530
use super :: { anonymous, NamedPipe , NamedPipeBuilder } ;
531
- use iocp:: CompletionPort ;
532
- use Overlapped ;
531
+ use crate :: iocp:: CompletionPort ;
532
+ use crate :: Overlapped ;
533
533
534
534
fn name ( ) -> String {
535
535
let name = thread_rng ( ) . gen_ascii_chars ( ) . take ( 30 ) . collect :: < String > ( ) ;
0 commit comments