mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
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:
@@ -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)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user