Merge pull request #174 from androbtech/recognize-more-unit

K raw unit is a kilobyte.
This commit is contained in:
Jonathan Turner 2019-07-16 05:53:03 +12:00 committed by GitHub
commit 15c95e5ffb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -217,6 +217,8 @@ pub fn raw_unit(input: NomSpan) -> IResult<NomSpan, Spanned<Unit>> {
tag("KB"),
tag("kb"),
tag("Kb"),
tag("K"),
tag("k"),
tag("MB"),
tag("mb"),
tag("Mb"),

View File

@ -46,8 +46,8 @@ impl FromStr for Unit {
type Err = ();
fn from_str(input: &str) -> Result<Self, <Self as std::str::FromStr>::Err> {
match input {
"B" | "b" => Ok(Unit::B),
"KB" | "kb" | "Kb" => Ok(Unit::KB),
"B" | "b" => Ok(Unit::B),
"KB" | "kb" | "Kb" | "K" | "k" => Ok(Unit::KB),
"MB" | "mb" | "Mb" => Ok(Unit::MB),
"GB" | "gb" | "Gb" => Ok(Unit::GB),
"TB" | "tb" | "Tb" => Ok(Unit::TB),