pub struct ProviderRegistry { /* private fields */ }Expand description
Registry of all known captcha providers. Replaces the standalone detector-only registry for new code; existing code can still use the legacy registry.
The default-constructed registry contains every built-in provider
in priority order (matching the legacy detector registry exactly).
Custom providers can be appended via ProviderRegistry::push.
Implementations§
Source§impl ProviderRegistry
impl ProviderRegistry
Sourcepub fn with_built_in_rules() -> Result<Self>
pub fn with_built_in_rules() -> Result<Self>
Built-in providers PLUS every rule from the bundled
community.toml rule pack: DataDome, Akamai, PerimeterX/HUMAN,
Arkose, Geetest v3+v4, AWS WAF, Friendly Captcha, MTCaptcha,
WordPress math captchas, and any other rules added to the pack.
The single-call entry point for production deployments that want maximum coverage out of the box.
Returns Err if the bundled TOML somehow fails to parse
which only happens if the in-tree community.toml has been
corrupted, since it is include_str!-ed at compile time.
Sourcepub fn push<P: CaptchaProvider + 'static>(&mut self, provider: P)
pub fn push<P: CaptchaProvider + 'static>(&mut self, provider: P)
Append a custom provider.
Sourcepub fn add_provider(&mut self, provider: Box<dyn CaptchaProvider>)
pub fn add_provider(&mut self, provider: Box<dyn CaptchaProvider>)
Append a pre-boxed provider (callers that already own a
Box<dyn CaptchaProvider>: typically the rule-watcher
hot-reload path which builds RuleDetectors and boxes
them up into the trait object form).
Sourcepub fn sort_by_priority(&mut self)
pub fn sort_by_priority(&mut self)
Re-sort the providers by priority. Idempotent. Used by
callers that batch-pushed via Self::add_provider and want to
pay the sort cost once at the end instead of per-push.
Sourcepub fn providers(&self) -> &[Box<dyn CaptchaProvider>]
pub fn providers(&self) -> &[Box<dyn CaptchaProvider>]
Borrow the providers in priority order.
Sourcepub fn find_by_kind(
&self,
kind: &DetectedCaptcha,
) -> Option<&dyn CaptchaProvider>
pub fn find_by_kind( &self, kind: &DetectedCaptcha, ) -> Option<&dyn CaptchaProvider>
Look up a provider by its DetectedCaptcha kind. Returns
None if no registered provider claims the kind. Used by the
solver chain to find the recommended solver list for a freshly
detected captcha without re-running detection.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ProviderRegistry
impl !UnwindSafe for ProviderRegistry
impl Freeze for ProviderRegistry
impl Send for ProviderRegistry
impl Sync for ProviderRegistry
impl Unpin for ProviderRegistry
impl UnsafeUnpin for ProviderRegistry
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
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>
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>
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