pub struct CdpConnection { /* private fields */ }Expand description
A CDP connection to a browser.
Implementations§
Source§impl CdpConnection
impl CdpConnection
Sourcepub async fn send_command<P, R>(
&self,
method: &str,
params: Option<P>,
session_id: Option<&str>,
) -> Result<R, CdpError>where
P: Serialize,
R: DeserializeOwned,
pub async fn send_command<P, R>(
&self,
method: &str,
params: Option<P>,
session_id: Option<&str>,
) -> Result<R, CdpError>where
P: Serialize,
R: DeserializeOwned,
Send a CDP command and wait for the response.
§Errors
Returns an error if:
- The command cannot be sent
- The response times out
- The browser returns a protocol error
Sourcepub async fn send_command_with_timeout<P, R>(
&self,
method: &str,
params: Option<P>,
session_id: Option<&str>,
timeout_duration: Duration,
) -> Result<R, CdpError>where
P: Serialize,
R: DeserializeOwned,
pub async fn send_command_with_timeout<P, R>(
&self,
method: &str,
params: Option<P>,
session_id: Option<&str>,
timeout_duration: Duration,
) -> Result<R, CdpError>where
P: Serialize,
R: DeserializeOwned,
Send a CDP command with a custom timeout.
§Errors
Returns an error if:
- The command cannot be sent
- The response times out
- The browser returns a protocol error
Sourcepub fn subscribe_events(&self) -> Receiver<CdpEvent>
pub fn subscribe_events(&self) -> Receiver<CdpEvent>
Subscribe to CDP events.
Returns a receiver that will receive all CDP events from the browser.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CdpConnection
impl !RefUnwindSafe for CdpConnection
impl Send for CdpConnection
impl Sync for CdpConnection
impl Unpin for CdpConnection
impl !UnwindSafe for CdpConnection
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