Add impl FromRow for the unit type (#2827)

This commit is contained in:
Nano 2023-10-24 05:45:33 +06:00 committed by GitHub
parent 068ea14665
commit ba87bf7473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -275,6 +275,16 @@ pub trait FromRow<'r, R: Row>: Sized {
fn from_row(row: &'r R) -> Result<Self, Error>;
}
impl<'r, R> FromRow<'r, R> for ()
where
R: Row,
{
#[inline]
fn from_row(_: &'r R) -> Result<Self, Error> {
Ok(())
}
}
// implement FromRow for tuples of types that implement Decode
// up to tuples of 9 values