use crypto::digest::Digest;
use crypto::md5::Md5;
pub fn get_str_md5(data:&String)->String{
let mut md5 = Md5::new();
md5.input_str(data.as_str());
md5.result_str()
}
use std::path::{Path};
pub fn file_exists(path:&String)->bool{
return Path::new(path).exists()
}
use std::time::{Instant};
pub struct TimeCount {
start:Instant
}
impl TimeCount{
pub fn new()->Self{
Self{
start:Instant::now()
}
}
pub fn seconds(&self)->f64{
self.start.elapsed().as_secs_f64()
}
pub fn minutes(&self)->f64{
self.start.elapsed().as_secs_f64()/60.0
}
pub fn hours(&self)->f64{
self.start.elapsed().as_secs_f64()/3600.0
}
}