removing dead code and problematic Default impls
This commit is contained in:
parent
b4883c414a
commit
80602a0ac9
2 changed files with 0 additions and 35 deletions
|
@ -51,15 +51,6 @@ pub struct Level {
|
||||||
difficulty_factor: u32,
|
difficulty_factor: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Level {
|
|
||||||
fn default() -> Self {
|
|
||||||
Level {
|
|
||||||
visitor_threshold: 0,
|
|
||||||
difficulty_factor: 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Bulder struct for [Level] to describe threshold-difficulty factor mapping
|
/// Bulder struct for [Level] to describe threshold-difficulty factor mapping
|
||||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||||
pub struct LevelBuilder {
|
pub struct LevelBuilder {
|
||||||
|
@ -176,15 +167,6 @@ impl DefenseBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Defense {
|
|
||||||
fn default() -> Self {
|
|
||||||
Defense {
|
|
||||||
levels: vec![Level::default()],
|
|
||||||
current_visitor_threshold: 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Defense {
|
impl Defense {
|
||||||
///! Difficulty is calculated as:
|
///! Difficulty is calculated as:
|
||||||
///! ```rust
|
///! ```rust
|
||||||
|
|
|
@ -76,8 +76,6 @@ use std::time::Duration;
|
||||||
|
|
||||||
use actix::dev::*;
|
use actix::dev::*;
|
||||||
use derive_builder::Builder;
|
use derive_builder::Builder;
|
||||||
use pow_sha256::PoW as ShaPoW;
|
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
use crate::defense::Defense;
|
use crate::defense::Defense;
|
||||||
|
|
||||||
|
@ -156,21 +154,6 @@ impl Handler<Visitor> for MCaptcha {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Message to decrement the visitor count
|
|
||||||
#[derive(Message, Deserialize)]
|
|
||||||
#[rtype(result = "()")]
|
|
||||||
pub struct VerifyPoW {
|
|
||||||
pow: ShaPoW<Vec<u8>>,
|
|
||||||
id: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Handler<VerifyPoW> for MCaptcha {
|
|
||||||
type Result = ();
|
|
||||||
fn handle(&mut self, _: VerifyPoW, _ctx: &mut Self::Context) -> Self::Result {
|
|
||||||
self.decrement_visiotr();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod tests {
|
pub mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
Loading…
Reference in a new issue