Skip to content

Commit 582a90f

Browse files
authored
Merge pull request #386 from cuviper/de-borsh
Deprecate the "borsh" feature
2 parents 0a836e8 + 9011739 commit 582a90f

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Diff for: Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ equivalent = { version = "1.0", default-features = false }
1919
arbitrary = { version = "1.0", optional = true, default-features = false }
2020
quickcheck = { version = "1.0", optional = true, default-features = false }
2121
serde = { version = "1.0", optional = true, default-features = false }
22-
borsh = { version = "1.2", optional = true, default-features = false }
2322
rayon = { version = "1.9", optional = true }
2423

24+
# deprecated: use borsh's "indexmap" feature instead.
25+
borsh = { version = "1.2", optional = true, default-features = false }
26+
2527
[dependencies.hashbrown]
2628
version = "0.15.0"
2729
default-features = false

Diff for: src/borsh.rs

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ use borsh::{BorshDeserialize, BorshSerialize};
1212
use crate::map::IndexMap;
1313
use crate::set::IndexSet;
1414

15+
// NOTE: the real `#[deprecated]` attribute doesn't work for trait implementations,
16+
// but we can get close by mimicking the message style for documentation.
17+
/// <div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: use borsh's <code>indexmap</code> feature instead.</span></div>
1518
impl<K, V, S> BorshSerialize for IndexMap<K, V, S>
1619
where
1720
K: BorshSerialize,
@@ -36,6 +39,7 @@ where
3639
}
3740
}
3841

42+
/// <div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: use borsh's <code>indexmap</code> feature instead.</span></div>
3943
impl<K, V, S> BorshDeserialize for IndexMap<K, V, S>
4044
where
4145
K: BorshDeserialize + Eq + Hash,
@@ -50,6 +54,7 @@ where
5054
}
5155
}
5256

57+
/// <div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: use borsh's <code>indexmap</code> feature instead.</span></div>
5358
impl<T, S> BorshSerialize for IndexSet<T, S>
5459
where
5560
T: BorshSerialize,
@@ -72,6 +77,7 @@ where
7277
}
7378
}
7479

80+
/// <div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: use borsh's <code>indexmap</code> feature instead.</span></div>
7581
impl<T, S> BorshDeserialize for IndexSet<T, S>
7682
where
7783
T: BorshDeserialize + Eq + Hash,

Diff for: src/lib.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@
3535
//! to [`IndexMap`] and [`IndexSet`]. Alternative implementations for
3636
//! (de)serializing [`IndexMap`] as an ordered sequence are available in the
3737
//! [`map::serde_seq`] module.
38-
//! * `borsh`: Adds implementations for [`BorshSerialize`] and [`BorshDeserialize`]
39-
//! to [`IndexMap`] and [`IndexSet`]. **Note:** When this feature is enabled,
40-
//! you cannot enable the `derive` feature of [`borsh`] due to a cyclic
41-
//! dependency. Instead, add the `borsh-derive` crate as an explicit
42-
//! dependency in your Cargo.toml and import as e.g.
43-
//! `use borsh_derive::{BorshSerialize, BorshDeserialize};`.
4438
//! * `arbitrary`: Adds implementations for the [`arbitrary::Arbitrary`] trait
4539
//! to [`IndexMap`] and [`IndexSet`].
4640
//! * `quickcheck`: Adds implementations for the [`quickcheck::Arbitrary`] trait
4741
//! to [`IndexMap`] and [`IndexSet`].
42+
//! * `borsh` (**deprecated**): Adds implementations for [`BorshSerialize`] and
43+
//! [`BorshDeserialize`] to [`IndexMap`] and [`IndexSet`]. Due to a cyclic
44+
//! dependency that arose between [`borsh`] and `indexmap`, `borsh v1.5.6`
45+
//! added an `indexmap` feature that should be used instead of enabling the
46+
//! feature here.
4847
//!
4948
//! _Note: only the `std` feature is enabled by default._
5049
//!

0 commit comments

Comments
 (0)