@@ -11,6 +11,9 @@ use std::ops::Deref;
11
11
use std:: slice;
12
12
use std:: sync:: Arc ;
13
13
14
+ #[ doc( inline) ]
15
+ pub use postgres_shared:: rows:: RowIndex ;
16
+
14
17
use { Error , Result , StatementInfo } ;
15
18
use error;
16
19
use transaction:: Transaction ;
@@ -251,40 +254,6 @@ impl<'a> Row<'a> {
251
254
}
252
255
}
253
256
254
- /// A trait implemented by types that can index into columns of a row.
255
- pub trait RowIndex {
256
- /// Returns the index of the appropriate column, or `None` if no such
257
- /// column exists.
258
- fn idx ( & self , _: & [ Column ] ) -> Option < usize > ;
259
- }
260
-
261
- impl RowIndex for usize {
262
- #[ inline]
263
- fn idx ( & self , columns : & [ Column ] ) -> Option < usize > {
264
- if * self >= columns. len ( ) {
265
- None
266
- } else {
267
- Some ( * self )
268
- }
269
- }
270
- }
271
-
272
- impl < ' a > RowIndex for & ' a str {
273
- #[ inline]
274
- fn idx ( & self , columns : & [ Column ] ) -> Option < usize > {
275
- if let Some ( idx) = columns. iter ( ) . position ( |d| d. name ( ) == * self ) {
276
- return Some ( idx) ;
277
- } ;
278
-
279
- // FIXME ASCII-only case insensitivity isn't really the right thing to
280
- // do. Postgres itself uses a dubious wrapper around tolower and JDBC
281
- // uses the US locale.
282
- columns. iter ( ) . position (
283
- |d| d. name ( ) . eq_ignore_ascii_case ( * self ) ,
284
- )
285
- }
286
- }
287
-
288
257
/// A lazily-loaded iterator over the resulting rows of a query.
289
258
pub struct LazyRows < ' trans , ' stmt > {
290
259
stmt : & ' stmt Statement < ' stmt > ,
0 commit comments