Skip to content

Commit 34a3e18

Browse files
tchardingsanket1729
authored andcommitted
Improve docs on the translator/translate traits
1 parent 870c0cd commit 34a3e18

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/lib.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ impl hash::Hash for DummySha256Hash {
390390
}
391391
}
392392

393-
/// Provides the conversion information required in [`TranslatePk`]
393+
/// Describes an object that can translate various keys and hashes from one key to the type
394+
/// associated with the other key. Used by the [`TranslatePk`] trait to do the actual translations.
394395
pub trait Translator<P, Q, E>
395396
where
396397
P: MiniscriptKey,
@@ -440,12 +441,8 @@ where
440441
}
441442
}
442443

443-
/// Converts a descriptor using abstract keys to one using specific keys.
444-
///
445-
/// # Panics
446-
///
447-
/// If `fpk` returns an uncompressed key when converting to a segwit descriptor.
448-
/// To prevent this panic, ensure `fpk` returns an error in this case instead.
444+
/// Converts a descriptor using abstract keys to one using specific keys. Uses translator `t` to do
445+
/// the actual translation function calls.
449446
pub trait TranslatePk<P, Q>
450447
where
451448
P: MiniscriptKey,
@@ -454,9 +451,8 @@ where
454451
/// The associated output type. This must be `Self<Q>`.
455452
type Output;
456453

457-
/// Translates a struct from one generic to another where the translation
458-
/// for Pk is provided by function `fpk`, and translation for PkH is
459-
/// provided by function `fpkh`.
454+
/// Translates a struct from one generic to another where the translations
455+
/// for Pk are provided by the given [`Translator`].
460456
fn translate_pk<T, E>(&self, translator: &mut T) -> Result<Self::Output, E>
461457
where
462458
T: Translator<P, Q, E>;

0 commit comments

Comments
 (0)