mirror of https://github.com/rwf2/Rocket.git
Preallocate 512 byte buffer for JSON deserialization.
This commit is contained in:
parent
bebdaabb58
commit
4a9c621fc2
|
@ -22,7 +22,7 @@ pub use serde_json::error::Error as SerdeError;
|
|||
fn from_reader_eager<R, T>(mut reader: R) -> serde_json::Result<T>
|
||||
where R: Read, T: DeserializeOwned
|
||||
{
|
||||
let mut s = String::new();
|
||||
let mut s = String::with_capacity(512);
|
||||
if let Err(io_err) = reader.read_to_string(&mut s) {
|
||||
// Error::io is private to serde_json. Do not use outside of Rocket.
|
||||
return Err(SerdeError::io(io_err));
|
||||
|
|
Loading…
Reference in New Issue