diff --git a/sqlx-core/src/type.rs b/sqlx-core/src/type.rs index f3784401..8ca5b384 100644 --- a/sqlx-core/src/type.rs +++ b/sqlx-core/src/type.rs @@ -54,6 +54,12 @@ pub trait TypeEncode: Type + Encode { } } +impl + Encode> TypeEncode for T { + fn type_id(&self, _ty: &Db::TypeInfo) -> Db::TypeId { + Self::type_id() + } +} + #[allow(clippy::module_name_repetitions)] pub trait TypeDecode<'r, Db: Database>: Type + Decode<'r, Db> {} diff --git a/sqlx-mysql/src/types/uint.rs b/sqlx-mysql/src/types/uint.rs index 2e00f3e6..2927994f 100644 --- a/sqlx-mysql/src/types/uint.rs +++ b/sqlx-mysql/src/types/uint.rs @@ -54,12 +54,6 @@ impl Type for u8 { } } -impl TypeEncode for u8 { - fn type_id(&self, _: &MySqlTypeInfo) -> MySqlTypeId { - >::type_id() - } -} - impl Encode for u8 { fn encode(&self, ty: &MySqlTypeInfo, out: &mut MySqlOutput<'_>) -> encode::Result<()> { match ty.id() {