pub struct ValidationResult {
pub target: ValidationTarget,
pub passed: bool,
pub score: Option<f64>,
pub details: HashMap<String, String>,
pub screenshot: Option<Vec<u8>>,
pub elapsed: Duration,
}Expand description
The outcome of running a single anti-bot validator.
§Example
use std::collections::HashMap;
use std::time::Duration;
use stygian_browser::validation::{ValidationResult, ValidationTarget};
let r = ValidationResult {
target: ValidationTarget::CreepJs,
passed: true,
score: Some(0.87),
details: HashMap::new(),
screenshot: None,
elapsed: Duration::from_secs(5),
};
assert!(r.passed);Fields§
§target: ValidationTargetWhich anti-bot service was tested.
passed: boolDid the page pass (not blocked, score above threshold)?
score: Option<f64>Normalised 0.0–1.0 score, where applicable.
details: HashMap<String, String>Target-specific extracted metrics as key/value pairs.
screenshot: Option<Vec<u8>>PNG screenshot captured on failure (base64-encoded when serialised).
elapsed: DurationWall-clock time taken for the validation.
Implementations§
Source§impl ValidationResult
impl ValidationResult
Sourcepub fn failed(target: ValidationTarget, reason: &str) -> Self
pub fn failed(target: ValidationTarget, reason: &str) -> Self
Construct a failure result without a screenshot.
§Example
use stygian_browser::validation::{ValidationResult, ValidationTarget};
let r = ValidationResult::failed(ValidationTarget::CreepJs, "timeout");
assert!(!r.passed);
assert!(r.details.contains_key("error"));Trait Implementations§
Source§impl Clone for ValidationResult
impl Clone for ValidationResult
Source§fn clone(&self) -> ValidationResult
fn clone(&self) -> ValidationResult
Returns a duplicate 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 ValidationResult
impl Debug for ValidationResult
Source§impl<'de> Deserialize<'de> for ValidationResult
impl<'de> Deserialize<'de> for ValidationResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ValidationResult
impl RefUnwindSafe for ValidationResult
impl Send for ValidationResult
impl Sync for ValidationResult
impl Unpin for ValidationResult
impl UnsafeUnpin for ValidationResult
impl UnwindSafe for ValidationResult
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