Skip to content

Commit 5d826e8

Browse files
committed
Fix the explicit methods on confidential::{Asset, Nonce}
They were changed on ::Value, but forgotten on the others.
1 parent 08dc933 commit 5d826e8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/confidential.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,12 @@ impl Asset {
231231
}
232232
}
233233

234-
/// Unwrap the explicit value of this type.
235-
/// Panics if [is_explicit] returns false.
236-
pub fn unwrap_explicit(&self) -> sha256d::Hash {
234+
/// Returns the explicit asset.
235+
/// Returns [None] if [is_explicit] returns false.
236+
pub fn explicit(&self) -> Option<sha256d::Hash> {
237237
match *self {
238-
Asset::Explicit(v) => v,
239-
_ => panic!("Called unwrap_explicit on non-explicit asset: {:?}", self),
238+
Asset::Explicit(v) => Some(v),
239+
_ => None,
240240
}
241241
}
242242
}
@@ -274,12 +274,12 @@ impl Nonce {
274274
}
275275
}
276276

277-
/// Unwrap the explicit value of this type.
278-
/// Panics if [is_explicit] returns false.
279-
pub fn unwrap_explicit(&self) -> sha256d::Hash {
277+
/// Returns the explicit nonce.
278+
/// Returns [None] if [is_explicit] returns false.
279+
pub fn explicit(&self) -> Option<sha256d::Hash> {
280280
match *self {
281-
Nonce::Explicit(v) => v,
282-
_ => panic!("Called unwrap_explicit on non-explicit nonce: {:?}", self),
281+
Nonce::Explicit(v) => Some(v),
282+
_ => None,
283283
}
284284
}
285285
}

0 commit comments

Comments
 (0)