feat: support [u8; N] as BYTEA

This commit is contained in:
Sylwester Rąpała 2022-06-29 22:11:12 +02:00
parent 0984ab1c58
commit 9daf8b1e5d

View File

@ -915,6 +915,18 @@ impl<'a> ToSql for &'a [u8] {
to_sql_checked!();
}
#[cfg(feature = "array-impls")]
impl<const N: usize> ToSql for [u8; N] {
fn to_sql(&self, _: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
types::bytea_to_sql(&self[..], w);
Ok(IsNull::No)
}
accepts!(BYTEA);
to_sql_checked!();
}
#[cfg(feature = "array-impls")]
impl<T: ToSql, const N: usize> ToSql for [T; N] {
fn to_sql(&self, ty: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {