mirror of
https://github.com/actix/actix-web.git
synced 2024-11-22 09:31:10 +00:00
update itoa to v1
This commit is contained in:
parent
de20d21703
commit
b3ac918d70
4 changed files with 15 additions and 9 deletions
|
@ -89,7 +89,7 @@ derive_more = "0.99.5"
|
|||
encoding_rs = "0.8"
|
||||
futures-core = { version = "0.3.7", default-features = false }
|
||||
futures-util = { version = "0.3.7", default-features = false }
|
||||
itoa = "0.4"
|
||||
itoa = "1"
|
||||
language-tags = "0.3"
|
||||
once_cell = "1.5"
|
||||
log = "0.4"
|
||||
|
|
|
@ -60,7 +60,7 @@ h2 = "0.3.9"
|
|||
http = "0.2.5"
|
||||
httparse = "1.5.1"
|
||||
httpdate = "1.0.1"
|
||||
itoa = "0.4"
|
||||
itoa = "1"
|
||||
language-tags = "0.3"
|
||||
local-channel = "0.1"
|
||||
log = "0.4"
|
||||
|
|
|
@ -87,7 +87,7 @@ impl fmt::Display for Quality {
|
|||
|
||||
// 0 is already handled so it's not possible to have a trailing 0 in this range
|
||||
// we can just write the integer
|
||||
itoa::fmt(f, x)
|
||||
itoa_fmt(f, x)
|
||||
} else if x < 100 {
|
||||
// x in is range 10–99
|
||||
|
||||
|
@ -95,21 +95,21 @@ impl fmt::Display for Quality {
|
|||
|
||||
if x % 10 == 0 {
|
||||
// trailing 0, divide by 10 and write
|
||||
itoa::fmt(f, x / 10)
|
||||
itoa_fmt(f, x / 10)
|
||||
} else {
|
||||
itoa::fmt(f, x)
|
||||
itoa_fmt(f, x)
|
||||
}
|
||||
} else {
|
||||
// x is in range 100–999
|
||||
|
||||
if x % 100 == 0 {
|
||||
// two trailing 0s, divide by 100 and write
|
||||
itoa::fmt(f, x / 100)
|
||||
itoa_fmt(f, x / 100)
|
||||
} else if x % 10 == 0 {
|
||||
// one trailing 0, divide by 10 and write
|
||||
itoa::fmt(f, x / 10)
|
||||
itoa_fmt(f, x / 10)
|
||||
} else {
|
||||
itoa::fmt(f, x)
|
||||
itoa_fmt(f, x)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,6 +117,12 @@ impl fmt::Display for Quality {
|
|||
}
|
||||
}
|
||||
|
||||
/// Write integer to a `fmt::Write`.
|
||||
pub fn itoa_fmt<W: fmt::Write, V: itoa::Integer>(mut wr: W, value: V) -> fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
wr.write_str(buf.format(value))
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Display, Error)]
|
||||
#[display(fmt = "quality out of bounds")]
|
||||
#[non_exhaustive]
|
||||
|
|
|
@ -74,7 +74,7 @@ futures-core = { version = "0.3.7", default-features = false, features = ["alloc
|
|||
futures-util = { version = "0.3.7", default-features = false, features = ["alloc", "sink"] }
|
||||
h2 = "0.3.9"
|
||||
http = "0.2.5"
|
||||
itoa = "0.4"
|
||||
itoa = "1"
|
||||
log =" 0.4"
|
||||
mime = "0.3"
|
||||
percent-encoding = "2.1"
|
||||
|
|
Loading…
Reference in a new issue