8080//! }
8181//! ```
8282#![ deny( missing_docs) ]
83+ #![ deny( rust_2018_idioms) ]
8384
8485// Note to developers: you can find decent overviews of the protocol at
8586//
9192//
9293// Wireshark also does a pretty good job at parsing the MySQL protocol.
9394
94- extern crate byteorder;
95- extern crate chrono;
9695extern crate mysql_common as myc;
97- extern crate nom;
9896
9997use std:: collections:: HashMap ;
10098use std:: io;
10199use std:: io:: prelude:: * ;
102100use std:: iter;
103101use std:: net;
104102
105- pub use myc:: constants:: { ColumnFlags , ColumnType , StatusFlags } ;
103+ pub use crate :: myc:: constants:: { ColumnFlags , ColumnType , StatusFlags } ;
106104
107105mod commands;
108106mod errorcodes;
@@ -132,10 +130,10 @@ pub struct Column {
132130 pub colflags : ColumnFlags ,
133131}
134132
135- pub use errorcodes:: ErrorKind ;
136- pub use params:: { ParamParser , ParamValue , Params } ;
137- pub use resultset:: { InitWriter , QueryResultWriter , RowWriter , StatementMetaWriter } ;
138- pub use value:: { ToMysqlValue , Value , ValueInner } ;
133+ pub use crate :: errorcodes:: ErrorKind ;
134+ pub use crate :: params:: { ParamParser , ParamValue , Params } ;
135+ pub use crate :: resultset:: { InitWriter , QueryResultWriter , RowWriter , StatementMetaWriter } ;
136+ pub use crate :: value:: { ToMysqlValue , Value , ValueInner } ;
139137
140138/// Implementors of this trait can be used to drive a MySQL-compatible database backend.
141139pub trait MysqlShim < W : Write > {
@@ -149,7 +147,11 @@ pub trait MysqlShim<W: Write> {
149147 /// The provided [`StatementMetaWriter`](struct.StatementMetaWriter.html) should be used to
150148 /// notify the client of the statement id assigned to the prepared statement, as well as to
151149 /// give metadata about the types of parameters and returned columns.
152- fn on_prepare ( & mut self , query : & str , info : StatementMetaWriter < W > ) -> Result < ( ) , Self :: Error > ;
150+ fn on_prepare (
151+ & mut self ,
152+ query : & str ,
153+ info : StatementMetaWriter < ' _ , W > ,
154+ ) -> Result < ( ) , Self :: Error > ;
153155
154156 /// Called when the client executes a previously prepared statement.
155157 ///
@@ -159,8 +161,8 @@ pub trait MysqlShim<W: Write> {
159161 fn on_execute (
160162 & mut self ,
161163 id : u32 ,
162- params : ParamParser ,
163- results : QueryResultWriter < W > ,
164+ params : ParamParser < ' _ > ,
165+ results : QueryResultWriter < ' _ , W > ,
164166 ) -> Result < ( ) , Self :: Error > ;
165167
166168 /// Called when the client wishes to deallocate resources associated with a previously prepared
@@ -171,10 +173,14 @@ pub trait MysqlShim<W: Write> {
171173 ///
172174 /// Results should be returned using the given
173175 /// [`QueryResultWriter`](struct.QueryResultWriter.html).
174- fn on_query ( & mut self , query : & str , results : QueryResultWriter < W > ) -> Result < ( ) , Self :: Error > ;
176+ fn on_query (
177+ & mut self ,
178+ query : & str ,
179+ results : QueryResultWriter < ' _ , W > ,
180+ ) -> Result < ( ) , Self :: Error > ;
175181
176182 /// Called when client switches database.
177- fn on_init ( & mut self , _: & str , _: InitWriter < W > ) -> Result < ( ) , Self :: Error > {
183+ fn on_init ( & mut self , _: & str , _: InitWriter < ' _ , W > ) -> Result < ( ) , Self :: Error > {
178184 Ok ( ( ) )
179185 }
180186}
@@ -259,7 +265,7 @@ impl<B: MysqlShim<W>, R: Read, W: Write> MysqlIntermediary<B, R, W> {
259265 }
260266
261267 fn run ( mut self ) -> Result < ( ) , B :: Error > {
262- use commands:: Command ;
268+ use crate :: commands:: Command ;
263269
264270 let mut stmts: HashMap < u32 , _ > = HashMap :: new ( ) ;
265271 while let Some ( ( seq, packet) ) = self . reader . next ( ) ? {
0 commit comments