pub struct DomainRegistry<H: DomainHandler> { /* private fields */ }Expand description
Registry of CDP domain handlers. Thread-safe (Mutex-protected). Generic over handler type H — enables enum dispatch (H=DomainDispatch) for zero-vtable overhead.
Implementations§
Source§impl<H: DomainHandler> DomainRegistry<H>
impl<H: DomainHandler> DomainRegistry<H>
pub fn new() -> Self
Sourcepub fn register(&self, handler: H) -> Result<(), String>
pub fn register(&self, handler: H) -> Result<(), String>
Register a DomainHandler. Returns Err if a handler with the same domain_name is already registered (REQ-CDS-006 C5: no overwrite).
Sourcepub fn dispatch_command(
&self,
method: &str,
params: Value,
event_sender: &dyn EventSender,
) -> Option<Result<Value, CdpError>>
pub fn dispatch_command( &self, method: &str, params: Value, event_sender: &dyn EventSender, ) -> Option<Result<Value, CdpError>>
Dispatch a command to the appropriate DomainHandler. Extracts domain from method (e.g. “Page.navigate” → “Page”).
Sourcepub fn notify_session_created(&self, domain: &str, session_id: &str)
pub fn notify_session_created(&self, domain: &str, session_id: &str)
Notify the DomainHandler for the given domain that a session was created.
Sourcepub fn notify_session_destroyed(&self, domains: &[String], session_id: &str)
pub fn notify_session_destroyed(&self, domains: &[String], session_id: &str)
Notify all DomainHandlers for the given domains that a session was destroyed.
Sourcepub fn has_domain(&self, domain: &str) -> bool
pub fn has_domain(&self, domain: &str) -> bool
Check if a domain is registered.
Trait Implementations§
Source§impl<H: DomainHandler> Default for DomainRegistry<H>
impl<H: DomainHandler> Default for DomainRegistry<H>
Source§impl<H: DomainHandler + 'static> RegistryDispatch for DomainRegistry<H>
Blanket impl: any DomainRegistry<H> is a RegistryDispatch.
impl<H: DomainHandler + 'static> RegistryDispatch for DomainRegistry<H>
Blanket impl: any DomainRegistry<H> is a RegistryDispatch.
Source§fn dispatch_command(
&self,
method: &str,
params: Value,
event_sender: &dyn EventSender,
) -> Option<Result<Value, CdpError>>
fn dispatch_command( &self, method: &str, params: Value, event_sender: &dyn EventSender, ) -> Option<Result<Value, CdpError>>
Dispatch a CDP command. Returns None if domain not found.
Source§fn notify_session_created(&self, domain: &str, session_id: &str)
fn notify_session_created(&self, domain: &str, session_id: &str)
Notify the handler for
domain that a session was created.Source§fn notify_session_destroyed(&self, domains: &[String], session_id: &str)
fn notify_session_destroyed(&self, domains: &[String], session_id: &str)
Notify handlers for the given domains that a session was destroyed.
Source§fn has_domain(&self, domain: &str) -> bool
fn has_domain(&self, domain: &str) -> bool
Check if a domain is registered.
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Downcast support — allows callers to recover the concrete registry type.
Source§fn dispatch_message(
&self,
msg: &CdpMessage,
ws_target_id: &str,
event_sender: &dyn EventSender,
) -> Option<Result<Value, CdpError>>
fn dispatch_message( &self, msg: &CdpMessage, ws_target_id: &str, event_sender: &dyn EventSender, ) -> Option<Result<Value, CdpError>>
Dispatch with full routing context: the incoming message (including
its optional
sessionId for flattened browser sessions) plus the WS
session’s own target id (from the /devtools/page/<id> URL, or the
browser pseudo-target for /devtools/browser connections). Read moreAuto Trait Implementations§
impl<H> !Freeze for DomainRegistry<H>
impl<H> RefUnwindSafe for DomainRegistry<H>
impl<H> Send for DomainRegistry<H>
impl<H> Sync for DomainRegistry<H>
impl<H> Unpin for DomainRegistry<H>where
H: Unpin,
impl<H> UnsafeUnpin for DomainRegistry<H>
impl<H> UnwindSafe for DomainRegistry<H>
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