pub fn parse_address(s: &str) -> Option<([u8; AccountAddress::LENGTH], NumberFormat)> {
    let (txt, base) = determine_num_text_and_base(s);
    let parsed = BigUint::parse_bytes(
        txt.as_bytes(),
        match base {
            NumberFormat::Hex => 16,
            NumberFormat::Decimal => 10,
        },
    )?;
    let bytes = parsed.to_bytes_be();
    if bytes.len() > AccountAddress::LENGTH {
        return None;
    }
    let mut result = [0u8; AccountAddress::LENGTH];
    result[(AccountAddress::LENGTH - bytes.len())..].clone_from_slice(&bytes);
    Some((result, base))
}
// Parse an address from a decimal or hex encoding
Parse an address from a decimal or hex encoding
Parse an address from a decimal or hex encoding
pub fn parse_address(s: &str) -> Option<([u8; AccountAddress::LENGTH], NumberFormat)> {
    let (txt, base) = determine_num_text_and_base(s);
    let parsed = BigUint::parse_bytes(
        txt.as_bytes(),
        match base {
            NumberFormat::Hex => 16,
            NumberFormat::Decimal => 10,
        },
    )?;
    let bytes = parsed.to_bytes_be();
    if bytes.len() > AccountAddress::LENGTH {
        return None;
    }
    let mut result = [0u8; AccountAddress::LENGTH];
    result[(AccountAddress::LENGTH - bytes.len())..].clone_from_slice(&bytes);
    Some((result, base))
}
pub fn parse_address ( s : & str ) -> Option < ( [ u8 ; AccountAddress :: LENGTH ] , NumberFormat ) > { let ( txt , base ) = determine_num_text_and_base ( s ) ; let parsed = BigUint :: parse_bytes ( txt . as_bytes ( ) , match base { NumberFormat :: Hex => 16 , NumberFormat :: Decimal => 10 , } , ) ? ; let bytes = parsed . to_bytes_be ( ) ; if bytes . len ( ) > AccountAddress :: LENGTH { return None ; } let mut result = [ 0u8 ; AccountAddress :: LENGTH ] ; result [ ( AccountAddress :: LENGTH - bytes . len ( ) ) .. ] . clone_from_slice ( & bytes ) ; Some ( ( result , base ) ) }
Parse an address from a decimal or hex encoding
Parse an address from a decimal or hex encoding
s
&str