mod basic_data;
mod global_fn;
use global_fn::{get_captcha, get_captcha_img};
#[test]
fn main() {
let a = Captcha::new(5,130,40);
println!("test:{},base_img:{}", a.text, a.base_img);
}
pub struct Captcha {
pub text: String,
pub base_img: String,
}
impl Captcha {
pub fn new(num: usize, width: u32, height: u32) -> Self {
let res = get_captcha(num);
let text = res.join("");
let base_img = get_captcha_img(res, width, height);
Captcha {
text,
base_img,
}
}
}