remove unnessary pub
This commit is contained in:
20
src/main.rs
20
src/main.rs
@@ -1,11 +1,11 @@
|
|||||||
// #[macro_use]
|
// #[macro_use]
|
||||||
// extern crate lazy_static;
|
// extern crate lazy_static;
|
||||||
extern crate sequoia_openpgp as openpgp;
|
extern crate sequoia_openpgp as openpgp;
|
||||||
pub mod oss_util;
|
mod oss_util;
|
||||||
pub mod pgp_util;
|
mod pgp_util;
|
||||||
pub mod config_util;
|
mod config_util;
|
||||||
pub mod zip_util;
|
mod zip_util;
|
||||||
pub mod opt;
|
mod opt;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
fs::{self, File},
|
fs::{self, File},
|
||||||
@@ -61,7 +61,7 @@ fn main() -> XResult<()> {
|
|||||||
Ok(())
|
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> {
|
oss_backupd_config :&OSSBackupdConfig, item_index: i32) -> Result<(), String> {
|
||||||
if options.verbose {
|
if options.verbose {
|
||||||
print_message(MessageType::DEBUG, &format!("Process config item index: {}, config: {:?}", item_index, config_item));
|
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(())
|
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);
|
let meta_file_key = &format!("{}/{}", path, meta_file_name);
|
||||||
if options.verbose {
|
if options.verbose {
|
||||||
print_message(MessageType::DEBUG, &format!("Read meta file: {}", meta_file_key));
|
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(())
|
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 removed_vec: Vec<String> = vec![];
|
||||||
let mut parsed_vec = parse_json_array(backup_content_json)?;
|
let mut parsed_vec = parse_json_array(backup_content_json)?;
|
||||||
while parsed_vec.len() + 1 > limit {
|
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
|
// 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();
|
let mut json_arr = json::JsonValue::new_array();
|
||||||
for v in vec {
|
for v in vec {
|
||||||
json_arr.push(json::JsonValue::from(v.as_str()))?;
|
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
|
// 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![];
|
let mut vec: Vec<String> = vec![];
|
||||||
if !arr.is_empty() {
|
if !arr.is_empty() {
|
||||||
let json_arr = &json::parse(&arr)?;
|
let json_arr = &json::parse(&arr)?;
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ impl OpenPGPTool {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn from_bytes(bs: &[u8]) -> XResult<OpenPGPTool> {
|
pub fn from_bytes(bs: &[u8]) -> XResult<OpenPGPTool> {
|
||||||
Ok(OpenPGPTool{
|
Ok(OpenPGPTool{
|
||||||
tpk: TPK::from_bytes(&bs)?,
|
tpk: TPK::from_bytes(&bs)?,
|
||||||
|
|||||||
Reference in New Issue
Block a user