pub struct DeterminismController { /* private fields */ }Expand description
Determinism controller for reproducible crawl results.
Ensures same input + same config → same output. Uses seed-based PRNG for any randomized operations.
§Examples
use crawlkit_engine::DeterminismController;
let ctrl = DeterminismController::new(42);
assert_eq!(ctrl.seed(), 42);
let seed1 = ctrl.derive_seed("context1");
let seed2 = ctrl.derive_seed("context1");
assert_ne!(seed1, seed2); // counter makes each call uniqueImplementations§
Source§impl DeterminismController
impl DeterminismController
Sourcepub fn with_default_seed() -> Self
pub fn with_default_seed() -> Self
Create with default seed (0).
Sourcepub fn derive_seed(&self, context: &str) -> u64
pub fn derive_seed(&self, context: &str) -> u64
Generate a deterministic seed for a specific context.
Sourcepub fn is_enforced(&self) -> bool
pub fn is_enforced(&self) -> bool
Check if determinism is enforced.
Sourcepub fn set_enforced(&self, enforced: bool)
pub fn set_enforced(&self, enforced: bool)
Enable or disable determinism enforcement.
Sourcepub fn content_hash(content: &str) -> u64
pub fn content_hash(content: &str) -> u64
Compute deterministic hash for content.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DeterminismController
impl RefUnwindSafe for DeterminismController
impl Send for DeterminismController
impl Sync for DeterminismController
impl Unpin for DeterminismController
impl UnsafeUnpin for DeterminismController
impl UnwindSafe for DeterminismController
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more