Skip to content

Commit 418d1be

Browse files
committed
Inline result indexing stuff
1 parent 8fa7858 commit 418d1be

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/postgres/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,7 @@ impl<'self> Container for PostgresRow<'self> {
897897
}
898898

899899
impl<'self, I: RowIndex, T: FromSql> Index<I, T> for PostgresRow<'self> {
900+
#[inline]
900901
fn index(&self, idx: &I) -> T {
901902
let idx = idx.idx(self.stmt);
902903
FromSql::from_sql(self.stmt.result_desc[idx].ty,
@@ -909,20 +910,23 @@ pub trait RowIndex {
909910
}
910911

911912
impl RowIndex for uint {
913+
#[inline]
912914
fn idx(&self, _stmt: &NormalPostgresStatement) -> uint {
913915
*self
914916
}
915917
}
916918

917919
// This is a convenience as the 0 in get[0] resolves to int :(
918920
impl RowIndex for int {
921+
#[inline]
919922
fn idx(&self, _stmt: &NormalPostgresStatement) -> uint {
920923
assert!(*self >= 0);
921924
*self as uint
922925
}
923926
}
924927

925928
impl<'self> RowIndex for &'self str {
929+
#[inline]
926930
fn idx(&self, stmt: &NormalPostgresStatement) -> uint {
927931
match stmt.find_col_named(*self) {
928932
Some(idx) => idx,

0 commit comments

Comments
 (0)