remove unnessary pub
This commit is contained in:
@@ -130,11 +130,11 @@ pub fn remove_start_end_slash(s: &str) -> String {
|
||||
let mut ss = s;
|
||||
while ss.starts_with("/") {
|
||||
ss = &ss[1..]
|
||||
}
|
||||
while ss.ends_with("/") {
|
||||
}
|
||||
while ss.ends_with("/") {
|
||||
ss = &ss[0..(ss.len() - 1)];
|
||||
}
|
||||
ss.to_string()
|
||||
}
|
||||
ss.to_string()
|
||||
}
|
||||
|
||||
pub fn parse_config(config_json: &json::JsonValue) -> OSSBackupdConfig {
|
||||
|
||||
20
src/main.rs
20
src/main.rs
@@ -1,11 +1,11 @@
|
||||
// #[macro_use]
|
||||
// extern crate lazy_static;
|
||||
extern crate sequoia_openpgp as openpgp;
|
||||
pub mod oss_util;
|
||||
pub mod pgp_util;
|
||||
pub mod config_util;
|
||||
pub mod zip_util;
|
||||
pub mod opt;
|
||||
mod oss_util;
|
||||
mod pgp_util;
|
||||
mod config_util;
|
||||
mod zip_util;
|
||||
mod opt;
|
||||
|
||||
use std::{
|
||||
fs::{self, File},
|
||||
@@ -61,7 +61,7 @@ fn main() -> XResult<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem,
|
||||
fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem,
|
||||
oss_backupd_config :&OSSBackupdConfig, item_index: i32) -> Result<(), String> {
|
||||
if options.verbose {
|
||||
print_message(MessageType::DEBUG, &format!("Process config item index: {}, config: {:?}", item_index, config_item));
|
||||
@@ -188,7 +188,7 @@ pub fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn process_oss_files(options: &Options, oss_client: &OSSClient, bucket_name: &str, path: &str, meta_file_name: &str, new_file: &str, limit: usize) -> XResult<()> {
|
||||
fn process_oss_files(options: &Options, oss_client: &OSSClient, bucket_name: &str, path: &str, meta_file_name: &str, new_file: &str, limit: usize) -> XResult<()> {
|
||||
let meta_file_key = &format!("{}/{}", path, meta_file_name);
|
||||
if options.verbose {
|
||||
print_message(MessageType::DEBUG, &format!("Read meta file: {}", meta_file_key));
|
||||
@@ -214,7 +214,7 @@ pub fn process_oss_files(options: &Options, oss_client: &OSSClient, bucket_name:
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn process_new_backup_file(backup_content_json: &str, new_item: &str, limit: usize) -> XResult<(Vec<String>, String)> {
|
||||
fn process_new_backup_file(backup_content_json: &str, new_item: &str, limit: usize) -> XResult<(Vec<String>, String)> {
|
||||
let mut removed_vec: Vec<String> = vec![];
|
||||
let mut parsed_vec = parse_json_array(backup_content_json)?;
|
||||
while parsed_vec.len() + 1 > limit {
|
||||
@@ -228,7 +228,7 @@ pub fn process_new_backup_file(backup_content_json: &str, new_item: &str, limit:
|
||||
}
|
||||
|
||||
// stringify JSON array
|
||||
pub fn stringity_json_array(vec: &Vec<String>) -> XResult<String> {
|
||||
fn stringity_json_array(vec: &Vec<String>) -> XResult<String> {
|
||||
let mut json_arr = json::JsonValue::new_array();
|
||||
for v in vec {
|
||||
json_arr.push(json::JsonValue::from(v.as_str()))?;
|
||||
@@ -237,7 +237,7 @@ pub fn stringity_json_array(vec: &Vec<String>) -> XResult<String> {
|
||||
}
|
||||
|
||||
// parse JSON array
|
||||
pub fn parse_json_array(arr: &str) -> XResult<Vec<String>> {
|
||||
fn parse_json_array(arr: &str) -> XResult<Vec<String>> {
|
||||
let mut vec: Vec<String> = vec![];
|
||||
if !arr.is_empty() {
|
||||
let json_arr = &json::parse(&arr)?;
|
||||
|
||||
@@ -45,6 +45,7 @@ impl OpenPGPTool {
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn from_bytes(bs: &[u8]) -> XResult<OpenPGPTool> {
|
||||
Ok(OpenPGPTool{
|
||||
tpk: TPK::from_bytes(&bs)?,
|
||||
|
||||
Reference in New Issue
Block a user