impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use Error::*;
match *self {
TooLong(len) => write!(f, "hrp is too long, found {} characters, must be <= 126", len), // <--- HERE
Empty => write!(f, "hrp is empty, must have at least 1 character"),
NonAsciiChar(c) => write!(f, "found non-ASCII character: {}", c),
InvalidAsciiByte(b) => write!(f, "byte value is not valid US-ASCII: \'{:x}\'", b),
MixedCase => write!(f, "hrp cannot mix upper and lower case"),
}
}
}
a previously defined constant should be used, like:
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use Error::*;
match *self {
TooLong(len) => write!(f, "hrp is too long, found {} characters, must be <= {}", len, MAX_HRP_LEN),
Empty => write!(f, "hrp is empty, must have at least 1 character"),
NonAsciiChar(c) => write!(f, "found non-ASCII character: {}", c),
InvalidAsciiByte(b) => write!(f, "byte value is not valid US-ASCII: \'{:x}\'", b),
MixedCase => write!(f, "hrp cannot mix upper and lower case"),
}
}
}
Currently, such an error is reported when the prefix is too long:
hrp is too long, found 85 characters, must be <= 126
which is somewhat confusing ;-).
Hi all,
I guess, in this line
a previously defined constant should be used, like:
Currently, such an error is reported when the prefix is too long: hrp is too long, found 85 characters, must be <= 126 which is somewhat confusing ;-).