sqlx_postgres/types/void.rs
1use crate::decode::Decode;
2use crate::error::BoxDynError;
3use crate::types::Type;
4use crate::{PgTypeInfo, PgValueRef, Postgres};
5
6impl 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
17impl<'r> Decode<'r, Postgres> for () {
18 fn decode(_value: PgValueRef<'r>) -> Result<Self, BoxDynError> {
19 Ok(())
20 }
21}