Trait easy_captcha::NewCaptcha
source · pub trait NewCaptchawhere
Self: Sized,{
// Required methods
fn new() -> Self;
fn with_size(width: i32, height: i32) -> Self;
fn with_size_and_len(width: i32, height: i32, len: usize) -> Self;
fn with_all(
width: i32,
height: i32,
len: usize,
font: CaptchaFont,
font_size: f32
) -> Self;
}Expand description
初始化验证码的抽象方法 Traits for initialize a Captcha instance.
Required Methods§
sourcefn with_size(width: i32, height: i32) -> Self
fn with_size(width: i32, height: i32) -> Self
使用输出图像大小初始化
Initialize the Captcha with the size of output image.
sourcefn with_size_and_len(width: i32, height: i32, len: usize) -> Self
fn with_size_and_len(width: i32, height: i32, len: usize) -> Self
使用输出图像大小和验证码字符长度初始化
Initialize the Captcha with the size of output image and the character length of the Captcha.
特别地/In particular:
- 对算术验证码ArithmeticCaptcha而言,这里的
len是验证码中数字的数量。 For ArithmeticCaptcha, thelenpresents the count of the digits in the Captcha.
sourcefn with_all(
width: i32,
height: i32,
len: usize,
font: CaptchaFont,
font_size: f32
) -> Self
fn with_all( width: i32, height: i32, len: usize, font: CaptchaFont, font_size: f32 ) -> Self
使用完整的参数来初始化,包括输出图像大小、验证码字符长度和输出字体及其大小
Initialize the Captcha with full properties, including the size of output image, the character length of the Captcha, and the font used in Captcha with the font size.
关于len字段的注意事项,请参见with_size_and_len中的说明。Refer to the document of
with_size_and_len for the precautions of the len property.
Object Safety§
This trait is not object safe.