@@ -387,11 +387,15 @@ impl OsIpcSharedMemory {
387387 }
388388}
389389
390- #[ derive( Debug , PartialEq ) ]
390+ #[ derive( Debug , PartialEq , Error ) ]
391391pub enum ChannelError {
392+ #[ error( "Channel Closed" ) ]
392393 ChannelClosedError ,
394+ #[ error( "Broken Pipe" ) ]
393395 BrokenPipeError ,
396+ #[ error( "Channel Empty" ) ]
394397 ChannelEmpty ,
398+ #[ error( "Unknown Error" ) ]
395399 UnknownError ,
396400}
397401
@@ -402,30 +406,11 @@ impl ChannelError {
402406 }
403407}
404408
405- impl fmt:: Display for ChannelError {
406- fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
407- match * self {
408- ChannelError :: ChannelClosedError => write ! ( fmt, "channel closed" ) ,
409- ChannelError :: BrokenPipeError => write ! ( fmt, "broken pipe" ) ,
410- ChannelError :: ChannelEmpty => write ! ( fmt, "channel empty" ) ,
411- ChannelError :: UnknownError => write ! ( fmt, "unknown error" ) ,
412- }
413- }
414- }
415-
416- impl StdError for ChannelError { }
417-
418- impl From < ChannelError > for bincode:: Error {
419- fn from ( crossbeam_error : ChannelError ) -> Self {
420- io:: Error :: from ( crossbeam_error) . into ( )
421- }
422- }
423-
424409impl From < ChannelError > for ipc:: IpcError {
425410 fn from ( error : ChannelError ) -> Self {
426411 match error {
427412 ChannelError :: ChannelClosedError => ipc:: IpcError :: Disconnected ,
428- e => ipc:: IpcError :: Bincode ( io:: Error :: from ( e) . into ( ) ) ,
413+ e => ipc:: IpcError :: Io ( io:: Error :: from ( e) . into ( ) ) ,
429414 }
430415 }
431416}
@@ -437,7 +422,7 @@ impl From<ChannelError> for ipc::TryRecvError {
437422 ipc:: TryRecvError :: IpcError ( ipc:: IpcError :: Disconnected )
438423 } ,
439424 ChannelError :: ChannelEmpty => ipc:: TryRecvError :: Empty ,
440- e => ipc:: TryRecvError :: IpcError ( ipc:: IpcError :: Bincode ( io:: Error :: from ( e) . into ( ) ) ) ,
425+ e => ipc:: TryRecvError :: IpcError ( ipc:: IpcError :: Io ( io:: Error :: from ( e) . into ( ) ) ) ,
441426 }
442427 }
443428}
0 commit comments