From 4d3e102f7ea68e32496b156ba819715873c1f555 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 26 Nov 2014 10:50:31 -0800 Subject: [PATCH] Add result_descriptions to Rows and Row This can be useful for functions that are just passed a `Rows` or `Row` and want to introspect a bit into the columns. --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index ac3f0521..c289eb35 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1364,6 +1364,11 @@ impl<'stmt> Rows<'stmt> { self.read_rows() } + /// Returns a slice describing the columns of the `Rows`. + pub fn result_descriptions(&self) -> &'stmt [ResultDescription] { + self.stmt.result_descriptions() + } + /// Consumes the `Rows`, cleaning up associated state. /// /// Functionally identical to the `Drop` implementation on `Rows` @@ -1416,6 +1421,11 @@ impl<'stmt> Row<'stmt> { self.data.len() } + /// Returns a slice describing the columns of the `Row`. + pub fn result_descriptions(&self) -> &'stmt [ResultDescription] { + self.stmt.result_descriptions() + } + /// Retrieves the contents of a field of the row. /// /// A field can be accessed by the name or index of its column, though