| 1 | use crate::decode::Decode; |
| 2 | use crate::error::BoxDynError; |
| 3 | use crate::types::Type; |
| 4 | use crate::{PgTypeInfo, PgValueRef, Postgres}; |
| 5 | |
| 6 | impl Type<Postgres> for () { |
| 7 | fn type_info() -> PgTypeInfo { |
| 8 | PgTypeInfo::VOID |
| 9 | } |
| 10 | |
| 11 | fn compatible(ty: &PgTypeInfo) -> bool { |
| 12 | // RECORD is here so we can support the empty tuple |
| 13 | *ty == PgTypeInfo::VOID || *ty == PgTypeInfo::RECORD |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | impl<'r> Decode<'r, Postgres> for () { |
| 18 | fn decode(_value: PgValueRef<'r>) -> Result<Self, BoxDynError> { |
| 19 | Ok(()) |
| 20 | } |
| 21 | } |