Skip to main content

DomainRegistry

Struct DomainRegistry 

Source
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>

Source

pub fn new() -> Self

Source

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).

Source

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”).

Source

pub fn notify_session_created(&self, domain: &str, session_id: &str)

Notify the DomainHandler for the given domain that a session was created.

Source

pub fn notify_session_destroyed(&self, domains: &[String], session_id: &str)

Notify all DomainHandlers for the given domains that a session was destroyed.

Source

pub fn has_domain(&self, domain: &str) -> bool

Check if a domain is registered.

Trait Implementations§

Source§

impl<H: DomainHandler> Default for DomainRegistry<H>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

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>>

Dispatch a CDP command. Returns None if domain not found.
Source§

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)

Notify handlers for the given domains that a session was destroyed.
Source§

fn has_domain(&self, domain: &str) -> bool

Check if a domain is registered.
Source§

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>>

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 more

Auto 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V