Skip to content

Commit d21090d

Browse files
committed
Add docs for TextRow getters
1 parent a1d759a commit d21090d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

postgres/src/text_rows.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,14 @@ impl<'a> TextRow<'a> {
145145
self.columns
146146
}
147147

148-
/// stub
148+
/// Retrieve the contents of a field of a row
149+
///
150+
/// A field can be accessed by the name or index of its column, though
151+
/// access by index is more efficient. Rows are 0-indexed.
152+
///
153+
/// # Panics
154+
///
155+
/// Panics if the index does not reference a column
149156
pub fn get<I>(&self, idx: I) -> &str
150157
where
151158
I: RowIndex + fmt::Debug,
@@ -157,7 +164,14 @@ impl<'a> TextRow<'a> {
157164
}
158165
}
159166

160-
/// stub
167+
/// Retrieves the contents of a field of the row.
168+
///
169+
/// A field can be accessed by the name or index of its column, though
170+
/// access by index is more efficient. Rows are 0-indexed.
171+
///
172+
/// Returns None if the index does not reference a column, Some(Err(..)) if
173+
/// there was an error parsing the result as UTF-8, and Some(Ok(..)) on
174+
/// success.
161175
pub fn get_opt<I>(&self, idx: I) -> Option<Result<&str>>
162176
where
163177
I: RowIndex,

0 commit comments

Comments
 (0)