@@ -11,6 +11,9 @@ use std::ops::Deref;
1111use std:: slice;
1212use std:: sync:: Arc ;
1313
14+ #[ doc( inline) ]
15+ pub use postgres_shared:: rows:: RowIndex ;
16+
1417use { Error , Result , StatementInfo } ;
1518use error;
1619use transaction:: Transaction ;
@@ -251,40 +254,6 @@ impl<'a> Row<'a> {
251254 }
252255}
253256
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-
288257/// A lazily-loaded iterator over the resulting rows of a query.
289258pub struct LazyRows < ' trans , ' stmt > {
290259 stmt : & ' stmt Statement < ' stmt > ,
0 commit comments