pub struct ArithmeticCaptcha { /* private fields */ }
Expand description

算数验证码

Implementations§

source§

impl ArithmeticCaptcha

source

pub fn alphas(&mut self) -> Vec<char>

生成一个算式

Generate a new arithmetic problem.

source

pub fn get_arithmetic_string(&mut self) -> String

获取算式的字符串

Get the String of the arithmetic problem

source

pub fn set_difficulty(&mut self, difficulty: usize)

设置算术的难度;默认值为10

Set the difficulty of the arithmetic problem; default as 10.

source

pub fn support_algorithm_sign(&mut self, algorithm_sign: usize)

设置包含的算术符号。可选2~5,难度依次由低到高(加-减-乘-除)

Set the arithmetic symbol used in the arithmetic problem; Available from 2 to 5, which includes Plus, Minus, Multiply and Divide.

Trait Implementations§

source§

impl AbstractCaptcha for ArithmeticCaptcha

§

type Error = EncodingError

错误类型
source§

fn out(&mut self, out: impl Write) -> Result<(), Self::Error>

输出验证码到指定位置 Read more
source§

fn get_chars(&mut self) -> Vec<char>

获取验证码中的字符(即正确答案) Read more
source§

fn base64(&mut self) -> Result<String, Self::Error>

输出Base64编码。注意,返回值会带编码头(例如data:image/png;base64,),可以直接在浏览器中显示;如不需要编码头, 请使用base64_with_head方法并传入空参数以去除编码头。 Read more
source§

fn get_content_type(&mut self) -> String

获取验证码的MIME类型 Read more
source§

fn base64_with_head(&mut self, head: &str) -> Result<String, Self::Error>

输出Base64编码(指定编码头) Read more
source§

impl NewCaptcha for ArithmeticCaptcha

source§

fn new() -> Self

用默认参数初始化 Read more
source§

fn with_size(width: i32, height: i32) -> Self

使用输出图像大小初始化 Read more
source§

fn with_size_and_len(width: i32, height: i32, len: usize) -> Self

使用输出图像大小和验证码字符长度初始化 Read more
source§

fn with_all( width: i32, height: i32, len: usize, font: CaptchaFont, font_size: f32 ) -> Self

使用完整的参数来初始化,包括输出图像大小、验证码字符长度和输出字体及其大小 Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V