Skip to content

Commit

Permalink
blanket_traits: add some more bounds
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
apoelstra committed Mar 5, 2024
1 parent 95b9337 commit 9280609
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions src/blanket_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
//! automatically implemented if you satisfy all the bounds.
//!
use core::fmt;
use core::str::FromStr;
use core::{fmt, hash};

use crate::MiniscriptKey;

Expand All @@ -28,19 +28,43 @@ pub trait FromStrKey:
> + FromStr<Err = Self::_FromStrErr>
{
/// Dummy type. Do not use.
type _Sha256: FromStr<Err = Self::_Sha256FromStrErr>;
type _Sha256: FromStr<Err = Self::_Sha256FromStrErr>
+ Clone
+ Eq
+ Ord
+ fmt::Display
+ fmt::Debug
+ hash::Hash;
/// Dummy type. Do not use.
type _Sha256FromStrErr: fmt::Debug + fmt::Display;
/// Dummy type. Do not use.
type _Hash256: FromStr<Err = Self::_Hash256FromStrErr>;
type _Hash256: FromStr<Err = Self::_Hash256FromStrErr>
+ Clone
+ Eq
+ Ord
+ fmt::Display
+ fmt::Debug
+ hash::Hash;
/// Dummy type. Do not use.
type _Hash256FromStrErr: fmt::Debug + fmt::Display;
/// Dummy type. Do not use.
type _Ripemd160: FromStr<Err = Self::_Ripemd160FromStrErr>;
type _Ripemd160: FromStr<Err = Self::_Ripemd160FromStrErr>
+ Clone
+ Eq
+ Ord
+ fmt::Display
+ fmt::Debug
+ hash::Hash;
/// Dummy type. Do not use.
type _Ripemd160FromStrErr: fmt::Debug + fmt::Display;
/// Dummy type. Do not use.
type _Hash160: FromStr<Err = Self::_Hash160FromStrErr>;
type _Hash160: FromStr<Err = Self::_Hash160FromStrErr>
+ Clone
+ Eq
+ Ord
+ fmt::Display
+ fmt::Debug
+ hash::Hash;
/// Dummy type. Do not use.
type _Hash160FromStrErr: fmt::Debug + fmt::Display;
/// Dummy type. Do not use.
Expand Down

0 comments on commit 9280609

Please sign in to comment.