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 ;
2
1
use std:: error:: Error as StdError ;
3
2
use std:: fmt;
4
3
use std:: io:: Error as IoError ;
5
- use std:: sync:: mpsc:: { RecvError , SendError } ;
6
4
7
5
pub type Result < T > = :: std:: result:: Result < T , Error > ;
8
6
@@ -41,7 +39,7 @@ pub enum Error {
41
39
/// An I/O error occurred while decoding the image.
42
40
Io ( IoError ) ,
43
41
/// 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
45
43
}
46
44
47
45
impl fmt:: Display for Error {
@@ -79,15 +77,3 @@ impl From<IoError> for Error {
79
77
Error :: Io ( err)
80
78
}
81
79
}
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 {
40
40
Ok ( ThreadedWorker { sender : tx } )
41
41
}
42
42
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" ) )
44
44
}
45
45
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" ) )
47
47
}
48
48
fn get_result ( & mut self , index : usize ) -> Result < Vec < u8 > > {
49
49
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" ) )
52
52
}
53
53
}
You can’t perform that action at this time.
0 commit comments