feat: implement Encode, Decode, Type for Arc<str> and Arc<[u8]> (and Rc equivalents) (#3675)

* implement Encode, Decode, Type for Arc<str> and Arc<[u8]> (and Rc equivalents)

* sqlx-sqlite: Remove clone in Encode impl

* sqlx-sqlite: Remove unnecessary impls
This commit is contained in:
Joey de Waal
2025-07-05 02:58:33 +02:00
committed by GitHub
parent 0f891a3c56
commit 60f67dbc39
10 changed files with 93 additions and 63 deletions

View File

@@ -200,3 +200,17 @@ where
<&T as Encode<DB>>::size_hint(&self.as_ref())
}
}
#[macro_export]
macro_rules! forward_encode_impl {
($for_type:ty, $forward_to:ty, $db:ident) => {
impl<'q> Encode<'q, $db> for $for_type {
fn encode_by_ref(
&self,
buf: &mut <$db as sqlx_core::database::Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, BoxDynError> {
<$forward_to as Encode<$db>>::encode(self.as_ref(), buf)
}
}
};
}