Implement AsRef<Statement> for Row(s) (#887)

This commit is contained in:
gwenn
2021-05-26 14:51:28 +02:00
committed by GitHub
parent 48e7561af9
commit df02910660
3 changed files with 13 additions and 68 deletions

View File

@@ -78,6 +78,11 @@ impl<'stmt> Rows<'stmt> {
{
AndThenRows { rows: self, map: f }
}
/// Give access to the underlying statement
pub fn as_ref(&self) -> Option<&Statement<'stmt>> {
self.stmt
}
}
impl<'stmt> Rows<'stmt> {
@@ -358,6 +363,12 @@ impl<'stmt> Row<'stmt> {
}
}
impl<'stmt> AsRef<Statement<'stmt>> for Row<'stmt> {
fn as_ref(&self) -> &Statement<'stmt> {
self.stmt
}
}
mod sealed {
/// This trait exists just to ensure that the only impls of `trait Params`
/// that are allowed are ones in this crate.