SparseMerklePath: impl From/Into conversions
This commit is contained in:
parent
743c65979a
commit
f1eb9a8f04
1 changed files with 24 additions and 0 deletions
|
@ -137,6 +137,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
|
// ITERATORS
|
||||||
// ================================================================================================
|
// ================================================================================================
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue