7
7
// option. This file may not be copied, modified, or distributed
8
8
// except according to those terms.
9
9
10
- use bincode :: serde:: DeserializeError ;
10
+ use serde;
11
11
use bincode;
12
12
use kernel32;
13
13
use libc:: intptr_t;
14
- use serde;
15
14
use std:: cell:: { Cell , RefCell } ;
16
15
use std:: cmp:: PartialEq ;
17
16
use std:: default:: Default ;
@@ -26,7 +25,7 @@ use std::slice;
26
25
use uuid:: Uuid ;
27
26
use winapi:: { HANDLE , INVALID_HANDLE_VALUE , LPVOID } ;
28
27
use winapi;
29
- use super :: Incrementor ;
28
+ use super :: incrementor :: Incrementor ;
30
29
31
30
lazy_static ! {
32
31
static ref CURRENT_PROCESS_ID : winapi:: ULONG = unsafe { kernel32:: GetCurrentProcessId ( ) } ;
@@ -118,7 +117,8 @@ impl<'data> Message<'data> {
118
117
119
118
fn oob_data ( & self ) -> Option < OutOfBandMessage > {
120
119
if self . oob_len > 0 {
121
- let oob = bincode:: serde:: deserialize :: < OutOfBandMessage > ( self . oob_bytes ( ) )
120
+
121
+ let oob = bincode:: deserialize :: < OutOfBandMessage > ( self . oob_bytes ( ) )
122
122
. expect ( "Failed to deserialize OOB data" ) ;
123
123
if oob. target_process_id != * CURRENT_PROCESS_ID {
124
124
panic ! ( "Windows IPC channel received handles intended for pid {}, but this is pid {}. \
@@ -184,7 +184,7 @@ impl OutOfBandMessage {
184
184
}
185
185
186
186
impl serde:: Serialize for OutOfBandMessage {
187
- fn serialize < S > ( & self , serializer : & mut S ) -> Result < ( ) , S :: Error >
187
+ fn serialize < S > ( & self , serializer : S ) -> Result < S :: Ok , S :: Error >
188
188
where S : serde:: Serializer
189
189
{
190
190
( ( self . target_process_id ,
@@ -195,7 +195,7 @@ impl serde::Serialize for OutOfBandMessage {
195
195
}
196
196
197
197
impl serde:: Deserialize for OutOfBandMessage {
198
- fn deserialize < D > ( deserializer : & mut D ) -> Result < OutOfBandMessage , D :: Error >
198
+ fn deserialize < D > ( deserializer : D ) -> Result < OutOfBandMessage , D :: Error >
199
199
where D : serde:: Deserializer
200
200
{
201
201
let ( target_process_id, channel_handles, shmem_handles, big_data_receiver_handle) =
@@ -938,7 +938,7 @@ impl OsIpcSender {
938
938
}
939
939
940
940
fn needs_fragmentation ( data_len : usize , oob : & OutOfBandMessage ) -> bool {
941
- let oob_size = if oob. needs_to_be_sent ( ) { bincode:: serde :: serialized_size ( oob) } else { 0 } ;
941
+ let oob_size = if oob. needs_to_be_sent ( ) { bincode:: serialized_size ( oob) } else { 0 } ;
942
942
943
943
// make sure we don't have too much oob data to begin with
944
944
assert ! ( ( oob_size as usize ) < ( PIPE_BUFFER_SIZE -MessageHeader :: size( ) ) , "too much oob data" ) ;
@@ -1023,7 +1023,7 @@ impl OsIpcSender {
1023
1023
// If we need to send OOB data, serialize it
1024
1024
let mut oob_data: Vec < u8 > = vec ! [ ] ;
1025
1025
if oob. needs_to_be_sent ( ) {
1026
- oob_data = bincode:: serde :: serialize ( & oob, bincode:: SizeLimit :: Infinite ) . unwrap ( ) ;
1026
+ oob_data = bincode:: serialize ( & oob, bincode:: Infinite ) . unwrap ( ) ;
1027
1027
}
1028
1028
1029
1029
unsafe {
@@ -1463,9 +1463,9 @@ impl WinError {
1463
1463
}
1464
1464
}
1465
1465
1466
- impl From < WinError > for DeserializeError {
1467
- fn from ( error : WinError ) -> DeserializeError {
1468
- DeserializeError :: IoError ( error. into ( ) )
1466
+ impl From < WinError > for bincode :: Error {
1467
+ fn from ( error : WinError ) -> bincode :: Error {
1468
+ Error :: from ( error) . into ( )
1469
1469
}
1470
1470
}
1471
1471
0 commit comments