mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
Make read_i64_from private and merge read_str_from to its caller
Also remove duplicated read_i64_from. Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
@@ -17,6 +17,7 @@ use std::sync::mpsc::Receiver;
|
||||
use crate::error::ErrorKind::*;
|
||||
use crate::error::*;
|
||||
use crate::events;
|
||||
use crate::read_i64_from;
|
||||
|
||||
use crate::flat_keyed_to_hashmap;
|
||||
|
||||
@@ -880,17 +881,6 @@ fn read_u64_from(mut file: File) -> Result<u64> {
|
||||
}
|
||||
}
|
||||
|
||||
fn read_i64_from(mut file: File) -> Result<i64> {
|
||||
let mut string = String::new();
|
||||
match file.read_to_string(&mut string) {
|
||||
Ok(_) => string
|
||||
.trim()
|
||||
.parse()
|
||||
.map_err(|e| Error::with_cause(ParseError, e)),
|
||||
Err(e) => Err(Error::with_cause(ReadFailed, e)),
|
||||
}
|
||||
}
|
||||
|
||||
fn read_string_from(mut file: File) -> Result<String> {
|
||||
let mut string = String::new();
|
||||
match file.read_to_string(&mut string) {
|
||||
|
||||
Reference in New Issue
Block a user