@@ -9,11 +9,11 @@ use crate::Bson;
99#[ non_exhaustive]
1010pub enum Error {
1111 /// A [`std::io::Error`](https://doc.rust-lang.org/std/io/struct.Error.html) encountered while deserializing.
12- IoError ( Arc < io:: Error > ) ,
12+ Io ( Arc < io:: Error > ) ,
1313
1414 /// A [`std::string::FromUtf8Error`](https://doc.rust-lang.org/std/string/struct.FromUtf8Error.html) encountered
1515 /// while decoding a UTF-8 String from the input data.
16- FromUtf8Error ( string:: FromUtf8Error ) ,
16+ InvalidUtf8String ( string:: FromUtf8Error ) ,
1717
1818 /// While decoding a `Document` from bytes, an unexpected or unsupported element type was
1919 /// encountered.
@@ -26,10 +26,6 @@ pub enum Error {
2626 element_type : u8 ,
2727 } ,
2828
29- /// There was an error with the syntactical structure of the BSON.
30- #[ non_exhaustive]
31- SyntaxError { message : String } ,
32-
3329 /// The end of the BSON input was reached too soon.
3430 EndOfStream ,
3531
@@ -54,21 +50,21 @@ pub enum Error {
5450
5551impl From < io:: Error > for Error {
5652 fn from ( err : io:: Error ) -> Error {
57- Error :: IoError ( Arc :: new ( err) )
53+ Error :: Io ( Arc :: new ( err) )
5854 }
5955}
6056
6157impl From < string:: FromUtf8Error > for Error {
6258 fn from ( err : string:: FromUtf8Error ) -> Error {
63- Error :: FromUtf8Error ( err)
59+ Error :: InvalidUtf8String ( err)
6460 }
6561}
6662
6763impl fmt:: Display for Error {
6864 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
6965 match * self {
70- Error :: IoError ( ref inner) => inner. fmt ( fmt) ,
71- Error :: FromUtf8Error ( ref inner) => inner. fmt ( fmt) ,
66+ Error :: Io ( ref inner) => inner. fmt ( fmt) ,
67+ Error :: InvalidUtf8String ( ref inner) => inner. fmt ( fmt) ,
7268 Error :: UnrecognizedDocumentElementType {
7369 ref key,
7470 element_type,
@@ -77,7 +73,6 @@ impl fmt::Display for Error {
7773 "unrecognized element type for key \" {}\" : `{:#x}`" ,
7874 key, element_type
7975 ) ,
80- Error :: SyntaxError { ref message } => message. fmt ( fmt) ,
8176 Error :: EndOfStream => fmt. write_str ( "end of stream" ) ,
8277 Error :: DeserializationError { ref message } => message. fmt ( fmt) ,
8378 Error :: InvalidDateTime { ref key, datetime } => {
@@ -90,8 +85,8 @@ impl fmt::Display for Error {
9085impl error:: Error for Error {
9186 fn source ( & self ) -> Option < & ( dyn error:: Error + ' static ) > {
9287 match * self {
93- Error :: IoError ( ref inner) => Some ( inner. as_ref ( ) ) ,
94- Error :: FromUtf8Error ( ref inner) => Some ( inner) ,
88+ Error :: Io ( ref inner) => Some ( inner. as_ref ( ) ) ,
89+ Error :: InvalidUtf8String ( ref inner) => Some ( inner) ,
9590 _ => None ,
9691 }
9792 }
0 commit comments