Skip to content

Commit

Permalink
Use associated item bounds syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
vorot93 committed Jun 20, 2024
1 parent b51b735 commit 27719b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
27 changes: 9 additions & 18 deletions src/orm/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ fn map_res_inner<T, E>(
v: Result<Option<(DecodableWrapper<T::Key>, DecodableWrapper<T::Value>)>, E>,
) -> anyhow::Result<Option<(T::Key, T::Value)>>
where
T: Table,
<T as Table>::Key: Decodable,
T: Table<Key: Decodable>,
E: std::error::Error + Send + Sync + 'static,
{
if let Some((k, v)) = v? {
Expand Down Expand Up @@ -105,14 +104,12 @@ where
start: Option<T::SeekKey>,
) -> impl Iterator<Item = anyhow::Result<(T::Key, T::Value)>>
where
T: Table,
T::Key: Decodable,
T: Table<Key: Decodable>,
{
struct I<'tx, K, T>
where
K: TransactionKind,
T: Table,
T::Key: Decodable,
T: Table<Key: Decodable>,
{
cursor: Cursor<'tx, K, T>,
start: Option<T::SeekKey>,
Expand All @@ -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<Key: Decodable>,
{
type Item = anyhow::Result<(T::Key, T::Value)>;

Expand Down Expand Up @@ -155,14 +151,12 @@ where
start: Option<T::SeekKey>,
) -> impl Iterator<Item = anyhow::Result<(T::Key, T::Value)>>
where
T: Table,
T::Key: Decodable,
T: Table<Key: Decodable>,
{
struct I<'tx, K, T>
where
K: TransactionKind,
T: Table,
T::Key: Decodable,
T: Table<Key: Decodable>,
{
cursor: Cursor<'tx, K, T>,
start: Option<T::SeekKey>,
Expand All @@ -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<Key: Decodable>,
{
type Item = anyhow::Result<(T::Key, T::Value)>;

Expand Down Expand Up @@ -275,8 +268,7 @@ where
struct I<'tx, K, T>
where
K: TransactionKind,
T: DupSort,
T::Key: Clone + Decodable,
T: DupSort<Key: Clone + Decodable>,
{
cursor: Cursor<'tx, K, T>,
start: Option<T::Key>,
Expand All @@ -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<Key: Clone + Decodable>,
{
type Item = anyhow::Result<T::Value>;

Expand Down
2 changes: 1 addition & 1 deletion src/orm/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ where

pub fn decode_key(encoded: &[u8]) -> anyhow::Result<T::Key>
where
<T as Table>::Key: Decodable,
T::Key: Decodable,
{
<T::Key as Decodable>::decode(encoded)
}
Expand Down

0 comments on commit 27719b6

Please sign in to comment.