Skip to content

Commit 9280609

Browse files
committed
blanket_traits: add some more bounds
It turns out that the `Sha256 = Self::_Sha256` requirement on `FromStrKey` is not sufficient for `FromStrKey::_Sha256` to implement all the traits that `Miniscript::Sha256` does. It further turns out that sometimes, for `#[derive(Debug)]` to work, Rust requires this. So just copy the bounds over explicitly.
1 parent 95b9337 commit 9280609

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

src/blanket_traits.rs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//! automatically implemented if you satisfy all the bounds.
1313
//!
1414
15-
use core::fmt;
1615
use core::str::FromStr;
16+
use core::{fmt, hash};
1717

1818
use crate::MiniscriptKey;
1919

@@ -28,19 +28,43 @@ pub trait FromStrKey:
2828
> + FromStr<Err = Self::_FromStrErr>
2929
{
3030
/// Dummy type. Do not use.
31-
type _Sha256: FromStr<Err = Self::_Sha256FromStrErr>;
31+
type _Sha256: FromStr<Err = Self::_Sha256FromStrErr>
32+
+ Clone
33+
+ Eq
34+
+ Ord
35+
+ fmt::Display
36+
+ fmt::Debug
37+
+ hash::Hash;
3238
/// Dummy type. Do not use.
3339
type _Sha256FromStrErr: fmt::Debug + fmt::Display;
3440
/// Dummy type. Do not use.
35-
type _Hash256: FromStr<Err = Self::_Hash256FromStrErr>;
41+
type _Hash256: FromStr<Err = Self::_Hash256FromStrErr>
42+
+ Clone
43+
+ Eq
44+
+ Ord
45+
+ fmt::Display
46+
+ fmt::Debug
47+
+ hash::Hash;
3648
/// Dummy type. Do not use.
3749
type _Hash256FromStrErr: fmt::Debug + fmt::Display;
3850
/// Dummy type. Do not use.
39-
type _Ripemd160: FromStr<Err = Self::_Ripemd160FromStrErr>;
51+
type _Ripemd160: FromStr<Err = Self::_Ripemd160FromStrErr>
52+
+ Clone
53+
+ Eq
54+
+ Ord
55+
+ fmt::Display
56+
+ fmt::Debug
57+
+ hash::Hash;
4058
/// Dummy type. Do not use.
4159
type _Ripemd160FromStrErr: fmt::Debug + fmt::Display;
4260
/// Dummy type. Do not use.
43-
type _Hash160: FromStr<Err = Self::_Hash160FromStrErr>;
61+
type _Hash160: FromStr<Err = Self::_Hash160FromStrErr>
62+
+ Clone
63+
+ Eq
64+
+ Ord
65+
+ fmt::Display
66+
+ fmt::Debug
67+
+ hash::Hash;
4468
/// Dummy type. Do not use.
4569
type _Hash160FromStrErr: fmt::Debug + fmt::Display;
4670
/// Dummy type. Do not use.

0 commit comments

Comments
 (0)