From ba87bf7473a14443ed146d3d06758dbadd608260 Mon Sep 17 00:00:00 2001 From: Nano Date: Tue, 24 Oct 2023 05:45:33 +0600 Subject: [PATCH] Add impl `FromRow` for the unit type (#2827) --- sqlx-core/src/from_row.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sqlx-core/src/from_row.rs b/sqlx-core/src/from_row.rs index 7bd835c455..234dd94176 100644 --- a/sqlx-core/src/from_row.rs +++ b/sqlx-core/src/from_row.rs @@ -275,6 +275,16 @@ pub trait FromRow<'r, R: Row>: Sized { fn from_row(row: &'r R) -> Result; } +impl<'r, R> FromRow<'r, R> for () +where + R: Row, +{ + #[inline] + fn from_row(_: &'r R) -> Result { + Ok(()) + } +} + // implement FromRow for tuples of types that implement Decode // up to tuples of 9 values