SparseMerklePath: impl From/Into conversions
This commit is contained in:
parent
8523e71281
commit
ac6ebe5a45
1 changed files with 24 additions and 0 deletions
|
@ -126,6 +126,30 @@ impl SparseMerklePath {
|
|||
}
|
||||
}
|
||||
|
||||
// CONVERSIONS
|
||||
// ================================================================================================
|
||||
|
||||
impl From<SparseMerklePath> for MerklePath {
|
||||
fn from(sparse_path: SparseMerklePath) -> Self {
|
||||
sparse_path.into_path()
|
||||
}
|
||||
}
|
||||
|
||||
/// # Panics
|
||||
///
|
||||
/// This conversion fails and panics if the path length is greater than [`SMT_MAX_DEPTH`].
|
||||
impl From<MerklePath> for SparseMerklePath {
|
||||
fn from(path: MerklePath) -> Self {
|
||||
SparseMerklePath::from_path(path).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SparseMerklePath> for Vec<RpoDigest> {
|
||||
fn from(path: SparseMerklePath) -> Self {
|
||||
path.into_path().into()
|
||||
}
|
||||
}
|
||||
|
||||
// ITERATORS
|
||||
// ================================================================================================
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue