1- use std:: borrow:: Cow ;
1+ use std:: {
2+ borrow:: Cow ,
3+ error:: Error as StdError ,
4+ fmt:: { self , Display } ,
5+ } ;
26
37use crate :: result_table:: { ColumnIndex , ColumnType } ;
48
@@ -9,12 +13,11 @@ pub type CellDecodeResult<T> = std::result::Result<T, CellConversionError>;
913
1014/// Cell-local reason why decoding a value failed.
1115///
12- /// This describes only the local conversion problem. Row, column, and
13- /// value context live on [`CellDecodeError`].
16+ /// This describes only the local conversion problem. Row, column, and value context live on [`CellDecodeError`].
1417#[ derive( Debug ) ]
1518pub struct CellConversionError {
1619 reason : Box < str > ,
17- source : Option < Box < dyn std :: error :: Error + Send + Sync + ' static > > ,
20+ source : Option < Box < dyn StdError + Send + Sync + ' static > > ,
1821}
1922
2023impl CellConversionError {
@@ -29,34 +32,31 @@ impl CellConversionError {
2932 & self . reason
3033 }
3134
32- pub fn source ( & self ) -> Option < & ( dyn std :: error :: Error + Send + Sync + ' static ) > {
35+ pub fn source ( & self ) -> Option < & ( dyn StdError + Send + Sync + ' static ) > {
3336 self . source . as_deref ( )
3437 }
3538}
3639
37- impl std :: fmt :: Display for CellConversionError {
38- fn fmt ( & self , f : & mut std :: fmt:: Formatter < ' _ > ) -> std :: fmt:: Result {
40+ impl Display for CellConversionError {
41+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
3942 f. write_str ( & self . reason )
4043 }
4144}
4245
43- impl std :: error :: Error for CellConversionError {
44- fn source ( & self ) -> Option < & ( dyn std :: error :: Error + ' static ) > {
46+ impl StdError for CellConversionError {
47+ fn source ( & self ) -> Option < & ( dyn StdError + ' static ) > {
4548 self . source . as_deref ( ) . map ( |source| source as _ )
4649 }
4750}
4851
4952#[ derive( Debug ) ]
5053pub struct CellConversionErrorBuilder {
5154 reason : Box < str > ,
52- source : Option < Box < dyn std :: error :: Error + Send + Sync + ' static > > ,
55+ source : Option < Box < dyn StdError + Send + Sync + ' static > > ,
5356}
5457
5558impl CellConversionErrorBuilder {
56- pub fn source (
57- mut self ,
58- source : impl Into < Box < dyn std:: error:: Error + Send + Sync + ' static > > ,
59- ) -> Self {
59+ pub fn source ( mut self , source : impl Into < Box < dyn StdError + Send + Sync + ' static > > ) -> Self {
6060 self . source = Some ( source. into ( ) ) ;
6161 self
6262 }
@@ -132,8 +132,8 @@ impl CellDecodeError {
132132 }
133133}
134134
135- impl std :: fmt :: Display for CellDecodeError {
136- fn fmt ( & self , f : & mut std :: fmt:: Formatter < ' _ > ) -> std :: fmt:: Result {
135+ impl Display for CellDecodeError {
136+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
137137 write ! (
138138 f,
139139 "row_index {} column_index {:?} ({}): target_type {}, found {:?}" ,
@@ -153,10 +153,10 @@ impl std::fmt::Display for CellDecodeError {
153153 }
154154}
155155
156- impl std :: error :: Error for CellDecodeError {
157- fn source ( & self ) -> Option < & ( dyn std :: error :: Error + ' static ) > {
156+ impl StdError for CellDecodeError {
157+ fn source ( & self ) -> Option < & ( dyn StdError + ' static ) > {
158158 self . issue
159159 . source ( )
160- . map ( |_| & self . issue as & ( dyn std :: error :: Error + ' static ) )
160+ . map ( |_| & self . issue as & ( dyn StdError + ' static ) )
161161 }
162162}
0 commit comments