pub struct PolymorphicBehaviorAdapter { /* private fields */ }Expand description
Polymorphic adapter selected from structured JSON input.
Implementations§
Source§impl PolymorphicBehaviorAdapter
impl PolymorphicBehaviorAdapter
Sourcepub fn from_json_str(json: &str) -> Result<Self>
pub fn from_json_str(json: &str) -> Result<Self>
Build an adapter from a JSON string.
§Errors
Returns BrowserError::ConfigError when JSON parsing fails or the
structure is invalid.
§Example
use stygian_browser::behavior_adapter::PolymorphicBehaviorAdapter;
use stygian_browser::BrowserConfig;
let json = r#"{"execution_mode":"Browser","session_mode":"Sticky","telemetry_level":"Deep","rate_limit_rps":0.8,"max_retries":4,"backoff_base_ms":1200,"enable_warmup":true,"enforce_webrtc_proxy_only":true,"sticky_session_ttl_secs":1800,"required_stygian_features":["browser"],"config_hints":{},"risk_score":0.9}"#;
let adapter = PolymorphicBehaviorAdapter::from_json_str(json).expect("valid adapter");
let mut cfg = BrowserConfig::default();
let plan = adapter.apply(&mut cfg);
assert!(plan.enable_warmup);Sourcepub fn from_json_value(value: Value) -> Result<Self>
pub fn from_json_value(value: Value) -> Result<Self>
Build an adapter from a JSON value.
§Errors
Returns BrowserError::ConfigError when the value does not match any
supported input envelope.
Sourcepub const fn kind(&self) -> AdapterKind
pub const fn kind(&self) -> AdapterKind
Return the selected adapter kind.
Sourcepub fn apply(&self, config: &mut BrowserConfig) -> AppliedBehaviorPlan
pub fn apply(&self, config: &mut BrowserConfig) -> AppliedBehaviorPlan
Apply behavior mutations to config and return the resulting plan.
Auto Trait Implementations§
impl Freeze for PolymorphicBehaviorAdapter
impl !RefUnwindSafe for PolymorphicBehaviorAdapter
impl Send for PolymorphicBehaviorAdapter
impl Sync for PolymorphicBehaviorAdapter
impl Unpin for PolymorphicBehaviorAdapter
impl UnsafeUnpin for PolymorphicBehaviorAdapter
impl !UnwindSafe for PolymorphicBehaviorAdapter
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