Skip to content

Commit c330d0b

Browse files
committed
remove the TranslatePk trait
We actually just empty it and deprecate it in an attempt to minimize breakage. People *implementing* the trait will break anyway because the next commit will have me changing the Translator trait. But the typical case is that somebody imports the trait, then calls .translate_pk on some object, and we want that usecase to continue working with only warnings.
1 parent 6e1d6bb commit c330d0b

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

src/descriptor/key.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,9 +1003,7 @@ impl DefiniteDescriptorKey {
10031003
/// always return a compressed key
10041004
///
10051005
/// Will return an error if the descriptor key has any hardened derivation steps in its path. To
1006-
/// avoid this error you should replace any such public keys first with [`translate_pk`].
1007-
///
1008-
/// [`translate_pk`]: crate::TranslatePk::translate_pk
1006+
/// avoid this error you should replace any such public keys first with [`crate::Descriptor::translate_pk`].
10091007
pub fn derive_public_key<C: Verification>(
10101008
&self,
10111009
secp: &Secp256k1<C>,

src/lib.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -368,31 +368,14 @@ impl<E: fmt::Debug> fmt::Debug for TranslateErr<E> {
368368

369369
/// Converts a descriptor using abstract keys to one using specific keys. Uses translator `t` to do
370370
/// the actual translation function calls.
371+
#[deprecated(since = "TBD", note = "This trait no longer needs to be imported.")]
371372
pub trait TranslatePk<P, Q>
372373
where
373374
P: MiniscriptKey,
374375
Q: MiniscriptKey,
375376
{
376-
/// The associated output type. This must be `Self<Q>`.
377-
type Output;
378-
379-
/// Translates a struct from one generic to another where the translations
380-
/// for Pk are provided by the given [`Translator`].
381-
fn translate_pk<T, E>(&self, translator: &mut T) -> Result<Self::Output, TranslateErr<E>>
382-
where
383-
T: Translator<P, Q, E>;
384377
}
385378

386-
/// Either a key or keyhash, but both contain Pk
387-
// pub struct ForEach<'a, Pk: MiniscriptKey>(&'a Pk);
388-
389-
// impl<'a, Pk: MiniscriptKey<Hash = Pk>> ForEach<'a, Pk> {
390-
// /// Convenience method to avoid distinguishing between keys and hashes when these are the same type
391-
// pub fn as_key(&self) -> &'a Pk {
392-
// self.0
393-
// }
394-
// }
395-
396379
/// Trait describing the ability to iterate over every key
397380
pub trait ForEachKey<Pk: MiniscriptKey> {
398381
/// Run a predicate on every key in the descriptor, returning whether

0 commit comments

Comments
 (0)