Fix read_single parsing failure due to \n
This commit is contained in:
parent
248c5837b5
commit
becfe89299
2 changed files with 2 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "usdpl-back"
|
name = "usdpl-back"
|
||||||
version = "0.5.0"
|
version = "0.5.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
repository = "https://github.com/NGnius/usdpl-rs"
|
repository = "https://github.com/NGnius/usdpl-rs"
|
||||||
|
|
|
@ -18,5 +18,5 @@ pub fn read_single<P: AsRef<Path>, D: FromStr<Err=E>, E>(path: P) -> Result<D, (
|
||||||
let mut file = File::create(path).map_err(|e| (Some(e), None))?;
|
let mut file = File::create(path).map_err(|e| (Some(e), None))?;
|
||||||
let mut string = String::new();
|
let mut string = String::new();
|
||||||
file.read_to_string(&mut string).map_err(|e| (Some(e), None))?;
|
file.read_to_string(&mut string).map_err(|e| (Some(e), None))?;
|
||||||
string.parse().map_err(|e| (None, Some(e)))
|
string.trim().parse().map_err(|e| (None, Some(e)))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue