pub fn from_string<S: AsRef<str>>(candidate: S) -> Result<Self, Report> {
        let s = strip_0x_prefix(candidate.as_ref());

        if s.len() != N {
            bail!("Expected string of length {}, got {}", N, s.len());
        }

        // Lazy. Should do the check as a cheaper action
        #[allow(clippy::question_mark)]
        if hex::decode(s).is_err() {
            bail!("String is not hex");
        }
        Ok(Self(s.to_owned()))
    }
/// Instantiate a new HexString from any `AsRef<str>`. Tolerates 0x
/// prefixing. A succesful instantiation will create an owned copy of the
/// string.
Instantiate a new HexString from any `AsRef`. Tolerates 0x
prefixing. A succesful instantiation will create an owned copy of the
string.
Instantiate a new HexString from any ` AsRef ` . Tolerates 0x prefixing . A succesful instantiation will create an owned copy of the string .
pub fn from_string<S: AsRef<str>>(candidate: S) -> Result<Self, Report> {
        let s = strip_0x_prefix(candidate.as_ref());
        if s.len() != N {
            bail!("Expected string of length {}, got {}", N, s.len());
        }
        // Lazy. Should do the check as a cheaper action
        #[allow(clippy::question_mark)]
        if hex::decode(s).is_err() {
            bail!("String is not hex");
        }
        Ok(Self(s.to_owned()))
    }
pub fn from_string < S : AsRef < str > > ( candidate : S ) -> Result < Self , Report > { let s = strip_0x_prefix ( candidate . as_ref ( ) ) ; if s . len ( ) != N { bail ! ( " " N s len ( ) ) ; } // Lazy. Should do the check as a cheaper action # [ allow ( clippy question_mark ) ] if hex :: decode ( s ) . is_err ( ) { bail ! ( " " ) ; } Ok ( Self ( s . to_owned ( ) ) ) }
Instantiate a new HexString from any `AsRef<str>`.
Instantiate a new HexString from any ` AsRef<str > ` .
candidate
S
candidate
S