File tree Expand file tree Collapse file tree 2 files changed +5
-19
lines changed Expand file tree Collapse file tree 2 files changed +5
-19
lines changed Original file line number Diff line number Diff line change 1- use std:: any:: Any ;
21use std:: error:: Error as StdError ;
32use std:: fmt;
43use std:: io:: Error as IoError ;
5- use std:: sync:: mpsc:: { RecvError , SendError } ;
64
75pub type Result < T > = :: std:: result:: Result < T , Error > ;
86
@@ -41,7 +39,7 @@ pub enum Error {
4139 /// An I/O error occurred while decoding the image.
4240 Io ( IoError ) ,
4341 /// An internal error occurred while decoding the image.
44- Internal ( Box < dyn StdError > ) ,
42+ Internal ( Box < dyn StdError + Send + Sync + ' static > ) , //TODO: not used, can be removed with the next version bump
4543}
4644
4745impl fmt:: Display for Error {
@@ -79,15 +77,3 @@ impl From<IoError> for Error {
7977 Error :: Io ( err)
8078 }
8179}
82-
83- impl From < RecvError > for Error {
84- fn from ( err : RecvError ) -> Error {
85- Error :: Internal ( Box :: new ( err) )
86- }
87- }
88-
89- impl < T : Any + Send > From < SendError < T > > for Error {
90- fn from ( err : SendError < T > ) -> Error {
91- Error :: Internal ( Box :: new ( err) )
92- }
93- }
Original file line number Diff line number Diff line change @@ -40,14 +40,14 @@ impl Worker for ThreadedWorker {
4040 Ok ( ThreadedWorker { sender : tx } )
4141 }
4242 fn start ( & mut self , row_data : RowData ) -> Result < ( ) > {
43- Ok ( self . sender . send ( WorkerMsg :: Start ( row_data) ) ? )
43+ Ok ( self . sender . send ( WorkerMsg :: Start ( row_data) ) . expect ( "jpeg-decoder worker thread error" ) )
4444 }
4545 fn append_row ( & mut self , row : ( usize , Vec < i16 > ) ) -> Result < ( ) > {
46- Ok ( self . sender . send ( WorkerMsg :: AppendRow ( row) ) ? )
46+ Ok ( self . sender . send ( WorkerMsg :: AppendRow ( row) ) . expect ( "jpeg-decoder worker thread error" ) )
4747 }
4848 fn get_result ( & mut self , index : usize ) -> Result < Vec < u8 > > {
4949 let ( tx, rx) = mpsc:: channel ( ) ;
50- self . sender . send ( WorkerMsg :: GetResult ( ( index, tx) ) ) ? ;
51- Ok ( rx. recv ( ) ? )
50+ self . sender . send ( WorkerMsg :: GetResult ( ( index, tx) ) ) . expect ( "jpeg-decoder worker thread error" ) ;
51+ Ok ( rx. recv ( ) . expect ( "jpeg-decoder worker thread error" ) )
5252 }
5353}
You can’t perform that action at this time.
0 commit comments