/// Converts an integer to a network type
Converts an integer to a network type
Converts an integer to a network type
pub fn from_u8(x: u8) -> Result<Network> {
        match x {
            x if x == Network::Mainnet as u8 => Ok(Network::Mainnet),
            x if x == Network::Testnet as u8 => Ok(Network::Testnet),
            x if x == Network::Regtest as u8 => Ok(Network::Regtest),
            x if x == Network::Ethereum as u8 => Ok(Network::Ethereum),
            x if x == Network::BsvMainnet as u8 => Ok(Network::BsvMainnet),
            x if x == Network::BsvRegtest as u8 => Ok(Network::BsvRegtest),
            _ => {
                let msg = format!("Unknown network type: {}", x);
                Err(Error::BadArgument(msg))
            }
        }
    }
pub fn from_u8 ( x : u8 ) -> Result < Network > { match x { x if x == Network :: Mainnet as u8 => Ok ( Network :: Mainnet ) , x if x == Network :: Testnet as u8 => Ok ( Network :: Testnet ) , x if x == Network :: Regtest as u8 => Ok ( Network :: Regtest ) , x if x == Network :: Ethereum as u8 => Ok ( Network :: Ethereum ) , x if x == Network :: BsvMainnet as u8 => Ok ( Network :: BsvMainnet ) , x if x == Network :: BsvRegtest as u8 => Ok ( Network :: BsvRegtest ) , _ => { let msg = format ! ( " " x ) ; Err ( Error :: BadArgument ( msg ) ) } } }
Converts an integer to a network type
Converts an integer to a network type
x
u8