Implement PgHasArrayType for all references (#2869)

This commit is contained in:
Tyler Hawkes 2024-03-14 13:38:19 -06:00 committed by GitHub
parent 0d0dddf1d0
commit b607251fc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View file

@ -55,6 +55,19 @@ pub trait PgHasArrayType {
}
}
impl<T> PgHasArrayType for &T
where
T: PgHasArrayType,
{
fn array_type_info() -> PgTypeInfo {
T::array_type_info()
}
fn array_compatible(ty: &PgTypeInfo) -> bool {
T::array_compatible(ty)
}
}
impl<T> PgHasArrayType for Option<T>
where
T: PgHasArrayType,

View file

@ -16,12 +16,6 @@ impl PgHasArrayType for &'_ [u8] {
}
}
impl<const N: usize> PgHasArrayType for &'_ [u8; N] {
fn array_type_info() -> PgTypeInfo {
PgTypeInfo::BYTEA_ARRAY
}
}
impl PgHasArrayType for Box<[u8]> {
fn array_type_info() -> PgTypeInfo {
<[&[u8]] as Type<Postgres>>::type_info()