Struct libmcaptcha::defense::LevelBuilder
source · pub struct LevelBuilder { /* private fields */ }
Expand description
Bulder struct for Level to describe threshold-difficulty factor mapping
Implementations§
source§impl LevelBuilder
impl LevelBuilder
sourcepub fn visitor_threshold(&mut self, visitor_threshold: u32) -> &mut Self
pub fn visitor_threshold(&mut self, visitor_threshold: u32) -> &mut Self
set visitor count for level
sourcepub fn difficulty_factor(
&mut self,
difficulty_factor: u32
) -> CaptchaResult<&mut Self>
pub fn difficulty_factor( &mut self, difficulty_factor: u32 ) -> CaptchaResult<&mut Self>
set difficulty factor for level. difficulty_factor can’t be zero because Difficulty is calculated as:
let difficulty_factor = 500;
let difficulty = u128::max_value() - u128::max_value() / difficulty_factor;
the higher the difficulty_factor
, the higher the difficulty.
sourcepub fn build(&mut self) -> CaptchaResult<Level>
pub fn build(&mut self) -> CaptchaResult<Level>
build Level struct
Trait Implementations§
source§impl Clone for LevelBuilder
impl Clone for LevelBuilder
source§fn clone(&self) -> LevelBuilder
fn clone(&self) -> LevelBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for LevelBuilder
impl Debug for LevelBuilder
source§impl Default for LevelBuilder
impl Default for LevelBuilder
source§impl PartialEq<LevelBuilder> for LevelBuilder
impl PartialEq<LevelBuilder> for LevelBuilder
source§fn eq(&self, other: &LevelBuilder) -> bool
fn eq(&self, other: &LevelBuilder) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for LevelBuilder
impl StructuralPartialEq for LevelBuilder
Auto Trait Implementations§
impl RefUnwindSafe for LevelBuilder
impl Send for LevelBuilder
impl Sync for LevelBuilder
impl Unpin for LevelBuilder
impl UnwindSafe for LevelBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more