@@ -216,18 +216,25 @@ impl SignetSystemConstants {
216216 }
217217}
218218
219- impl FromStr for SignetSystemConstants {
220- type Err = ParseChainError ;
219+ impl TryFrom < KnownChains > for SignetSystemConstants {
220+ type Error = ParseChainError ;
221221
222- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
223- let chain: KnownChains = s. parse ( ) ?;
222+ fn try_from ( chain : KnownChains ) -> Result < Self , Self :: Error > {
224223 match chain {
225224 #[ cfg( any( test, feature = "test-utils" ) ) ]
226225 KnownChains :: Test => Ok ( Self :: test ( ) ) ,
227226 }
228227 }
229228}
230229
230+ impl FromStr for SignetSystemConstants {
231+ type Err = ParseChainError ;
232+
233+ fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
234+ s. parse :: < KnownChains > ( ) ?. try_into ( )
235+ }
236+ }
237+
231238/// All constants pertaining to the Signet system.
232239#[ derive( Debug , Clone , PartialEq , Eq ) ]
233240pub struct SignetConstants {
@@ -273,14 +280,21 @@ impl SignetConstants {
273280 }
274281}
275282
276- impl FromStr for SignetConstants {
277- type Err = ParseChainError ;
283+ impl TryFrom < KnownChains > for SignetConstants {
284+ type Error = ParseChainError ;
278285
279- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
280- let chain: KnownChains = s. parse ( ) ?;
286+ fn try_from ( chain : KnownChains ) -> Result < Self , Self :: Error > {
281287 match chain {
282288 #[ cfg( any( test, feature = "test-utils" ) ) ]
283289 KnownChains :: Test => Ok ( Self :: test ( ) ) ,
284290 }
285291 }
286292}
293+
294+ impl FromStr for SignetConstants {
295+ type Err = ParseChainError ;
296+
297+ fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
298+ s. parse :: < KnownChains > ( ) ?. try_into ( )
299+ }
300+ }
0 commit comments