Implement standard conversions `Network`->`Params`

This commit is contained in:
Martin Habovstiak 2023-11-05 11:35:08 +01:00
parent 9a8694fae5
commit 9282cc4dad
1 changed files with 24 additions and 0 deletions

View File

@ -116,3 +116,27 @@ impl Params {
self.pow_target_timespan / self.pow_target_spacing self.pow_target_timespan / self.pow_target_spacing
} }
} }
impl From<Network> for Params {
fn from(value: Network) -> Self {
Self::new(value)
}
}
impl From<&Network> for Params {
fn from(value: &Network) -> Self {
Self::new(*value)
}
}
impl From<Network> for &'static Params {
fn from(value: Network) -> Self {
value.params()
}
}
impl From<&Network> for &'static Params {
fn from(value: &Network) -> Self {
value.params()
}
}