diff --git a/Cargo.toml b/Cargo.toml index 4948d04..5f6fcbe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rust_util" -version = "0.6.10" +version = "0.6.11" authors = ["Hatter Jiang "] edition = "2018" description = "Hatter's Rust Util" @@ -9,12 +9,12 @@ readme = "README.md" [features] default = [] #["serde", "serde_json"] -use_serde = ["serde", "serde_json"] +# use_serde = ["serde", "serde_json"] [dependencies] libc = "0.2.65" term = "0.5.2" term_size = "0.3.1" lazy_static = "1.3.0" -serde = { version = "1.0", features = ["derive"], optional = true } -serde_json = { version = "1.0", optional = true } +# serde = { version = "1.0", features = ["derive"], optional = true } +# serde_json = { version = "1.0", optional = true } diff --git a/src/util_file.rs b/src/util_file.rs index 266d714..76560c0 100644 --- a/src/util_file.rs +++ b/src/util_file.rs @@ -1,11 +1,9 @@ - use std::{ env, fs::{ self, File }, io::{ Lines, BufReader }, path::{ Path, PathBuf }, }; - use crate::{ iff, util_os, @@ -118,18 +116,6 @@ pub fn find_parents_exists_dir(dir: &str) -> Option { } } -#[cfg(feature = "use_serde")] -pub fn read_json_config(config: Option, files: &[String]) -> XResult> where T: serde::de::DeserializeOwned { - let config_path_buf_opt = read_config(config, files); - match config_path_buf_opt { - None => Ok(None), - Some(config_path_buf) => { - let json_config: T = serde_json::from_reader(std::fs::File::open(&config_path_buf)?)?; - Ok(Some((config_path_buf, json_config))) - } - } -} - pub fn read_config(config: Option, files: &[String]) -> Option { match config { Some(config_str) => Some(PathBuf::from(config_str)),