pub struct ProviderRegistry { /* private fields */ }Expand description
Registry of all known captcha providers. Replaces the standalone
[DetectorRegistry] for new code; existing code can still use the
detector-only 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 [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.