1+ use crate :: StoreError ;
12use bincode:: Options ;
23use std:: {
34 fs:: File ,
@@ -37,7 +38,7 @@ impl<'t, T> Iterator for EntryIter<'t, T>
3738where
3839 T : serde:: de:: DeserializeOwned ,
3940{
40- type Item = Result < T , IterError > ;
41+ type Item = Result < T , StoreError > ;
4142
4243 fn next ( & mut self ) -> Option < Self :: Item > {
4344 if self . finished {
6364 }
6465 }
6566 self . db_file . seek ( io:: SeekFrom :: Start ( pos_before_read) ) ?;
66- Err ( IterError :: Bincode ( * e) )
67+ Err ( StoreError :: Bincode ( * e) )
6768 }
6869 }
6970 } ) ( )
@@ -80,29 +81,3 @@ impl<'t, T> Drop for EntryIter<'t, T> {
8081 }
8182 }
8283}
83-
84- /// Error type for [`EntryIter`].
85- #[ derive( Debug ) ]
86- pub enum IterError {
87- /// Failure to read from the file.
88- Io ( io:: Error ) ,
89- /// Failure to decode data from the file.
90- Bincode ( bincode:: ErrorKind ) ,
91- }
92-
93- impl core:: fmt:: Display for IterError {
94- fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
95- match self {
96- IterError :: Io ( e) => write ! ( f, "io error trying to read entry {}" , e) ,
97- IterError :: Bincode ( e) => write ! ( f, "bincode error while reading entry {}" , e) ,
98- }
99- }
100- }
101-
102- impl From < io:: Error > for IterError {
103- fn from ( value : io:: Error ) -> Self {
104- IterError :: Io ( value)
105- }
106- }
107-
108- impl std:: error:: Error for IterError { }
0 commit comments