1
0
mirror of https://github.com/jht5945/rust_util.git synced 2025-12-27 15:40:03 +08:00

add split_kv

This commit is contained in:
2020-05-02 12:58:13 +08:00
parent 2f7d7d238e
commit 46528c566c
3 changed files with 4 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "rust_util"
version = "0.2.2"
version = "0.2.3"
authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018"
description = "Hatter's Rust Util"

View File

@@ -9,6 +9,7 @@ pub mod util_os;
pub mod util_env;
pub mod util_cmd;
pub mod util_msg;
pub mod util_str;
pub mod util_size;
pub mod util_file;
pub mod util_time;

View File

@@ -11,6 +11,7 @@ use std::{
use super::{ XResult, new_box_ioerror, };
use super::util_size::get_display_size;
use super::util_msg::print_lastline;
use super::util_file::resolve_file_path;
pub const DEFAULT_BUF_SIZE: usize = 8 * 1024;
@@ -19,7 +20,7 @@ pub fn get_read_stdin_or_file(file: &str) -> XResult<Box<dyn Read>> {
if file.is_empty() {
Ok(Box::new(io::stdin()))
} else {
match File::open(file) {
match File::open(&resolve_file_path(file)) {
Ok(f) => Ok(Box::new(f)),
Err(err) => Err(new_box_ioerror(&format!("Open file {}, erorr: {}", file, err))),
}