From 27719b6a189027ec11b762bd812db023f679c230 Mon Sep 17 00:00:00 2001 From: Artem Vorotnikov Date: Thu, 20 Jun 2024 04:39:44 +0300 Subject: [PATCH] Use associated item bounds syntax --- Cargo.toml | 1 + src/orm/cursor.rs | 27 +++++++++------------------ src/orm/database.rs | 2 +- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 140dd5a..582dc87 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "libmdbx" version = "0.5.0" edition = "2021" +rust-version = "1.79" license = "MPL-2.0" description = "Idiomatic and safe MDBX wrapper." documentation = "https://docs.rs/libmdbx" diff --git a/src/orm/cursor.rs b/src/orm/cursor.rs index 9099808..8f9d843 100644 --- a/src/orm/cursor.rs +++ b/src/orm/cursor.rs @@ -34,8 +34,7 @@ fn map_res_inner( v: Result, DecodableWrapper)>, E>, ) -> anyhow::Result> where - T: Table, - ::Key: Decodable, + T: Table, E: std::error::Error + Send + Sync + 'static, { if let Some((k, v)) = v? { @@ -105,14 +104,12 @@ where start: Option, ) -> impl Iterator> where - T: Table, - T::Key: Decodable, + T: Table, { struct I<'tx, K, T> where K: TransactionKind, - T: Table, - T::Key: Decodable, + T: Table, { cursor: Cursor<'tx, K, T>, start: Option, @@ -123,8 +120,7 @@ where impl<'tx, K, T> Iterator for I<'tx, K, T> where K: TransactionKind, - T: Table, - T::Key: Decodable, + T: Table, { type Item = anyhow::Result<(T::Key, T::Value)>; @@ -155,14 +151,12 @@ where start: Option, ) -> impl Iterator> where - T: Table, - T::Key: Decodable, + T: Table, { struct I<'tx, K, T> where K: TransactionKind, - T: Table, - T::Key: Decodable, + T: Table, { cursor: Cursor<'tx, K, T>, start: Option, @@ -173,8 +167,7 @@ where impl<'tx, K, T> Iterator for I<'tx, K, T> where K: TransactionKind, - T: Table, - T::Key: Decodable, + T: Table, { type Item = anyhow::Result<(T::Key, T::Value)>; @@ -275,8 +268,7 @@ where struct I<'tx, K, T> where K: TransactionKind, - T: DupSort, - T::Key: Clone + Decodable, + T: DupSort, { cursor: Cursor<'tx, K, T>, start: Option, @@ -288,8 +280,7 @@ where impl<'tx, K, T> Iterator for I<'tx, K, T> where K: TransactionKind, - T: DupSort, - T::Key: Clone + Decodable, + T: DupSort, { type Item = anyhow::Result; diff --git a/src/orm/database.rs b/src/orm/database.rs index 3b956ff..8cf78ce 100644 --- a/src/orm/database.rs +++ b/src/orm/database.rs @@ -161,7 +161,7 @@ where pub fn decode_key(encoded: &[u8]) -> anyhow::Result where - ::Key: Decodable, + T::Key: Decodable, { ::decode(encoded) }