We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e1f0802 commit 6267818Copy full SHA for 6267818
1 file changed
src/lib.rs
@@ -365,6 +365,20 @@ impl<E> TranslateErr<E> {
365
}
366
367
368
+impl TranslateErr<core::convert::Infallible> {
369
+ /// Remove the impossible "translator error" case and return a context error.
370
+ ///
371
+ /// When the translator error type is [`core::convert::Infallible`], which is
372
+ /// impossible to construct, allows unwrapping the outer error without any
373
+ /// panic paths.
374
+ pub fn into_outer_err(self) -> Error {
375
+ match self {
376
+ Self::TranslatorErr(impossible) => match impossible {},
377
+ Self::OuterError(e) => e,
378
+ }
379
380
+}
381
+
382
impl TranslateErr<Error> {
383
/// If we are doing a translation where our "outer error" is the generic
384
/// Miniscript error, eliminate the `TranslateErr` type which is just noise.
0 commit comments