use rust_util

This commit is contained in:
2019-12-28 09:54:00 +08:00
parent 0a7a0deedb
commit 428f41944b
2 changed files with 8 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
[package] [package]
name = "simple-oss" name = "oss"
version = "0.1.0" version = "0.1.0"
authors = ["Hatter Jiang <jht5945@gmail.com>"] authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018" edition = "2018"
@@ -16,4 +16,4 @@ rust-crypto = "0.2.36"
urlencoding = "1.0.0" urlencoding = "1.0.0"
base64 = "0.11.0" base64 = "0.11.0"
reqwest = "0.9.22" reqwest = "0.9.22"
rust_util="0.1.0" rust_util="0.2.0"

View File

@@ -1,6 +1,5 @@
use std::{ use std::{
fs::File, fs::File,
time::SystemTime,
}; };
use crypto::{ use crypto::{
mac::{ mac::{
@@ -13,14 +12,12 @@ use crypto::{
use reqwest::{ use reqwest::{
Response, Response,
}; };
use rust_util::*; use rust_util::{
iff,
/// iff!(condition, result_when_true, result_when_false) XResult,
macro_rules! iff { new_box_ioerror,
($c:expr, $t:expr, $f:expr) => { util_time::get_current_secs,
if $c { $t } else { $f }
}; };
}
pub const OSS_VERB_GET: &str = "GET"; pub const OSS_VERB_GET: &str = "GET";
pub const OSS_VERB_PUT: &str = "PUT"; pub const OSS_VERB_PUT: &str = "PUT";
@@ -134,7 +131,3 @@ fn calc_hmac_sha1(key: &[u8], message: &[u8]) -> MacResult {
hmac.input(message); hmac.input(message);
hmac.result() hmac.result()
} }
fn get_current_secs() -> u64 {
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs()
}