pub struct CdpSession<'a> { /* private fields */ }Expand description
A handle for driving one attached target over the client’s connection.
Borrowed from the client on purpose: a session cannot outlive the connection
it is multiplexed onto. To hold one past that borrow, keep the session id and
rebuild the handle with CdpClient::session.
Implementations§
Source§impl<'a> CdpSession<'a>
impl<'a> CdpSession<'a>
Sourcepub async fn call_raw(&self, method: &str, params: Value) -> Result<Value>
pub async fn call_raw(&self, method: &str, params: Value) -> Result<Value>
Send any CDP command in this session and return its raw result object.
The counterpart of CdpClient::call_raw, differing only in that the
command is addressed to this session rather than to the connected target.
Sourcepub async fn call<P: Serialize, R: DeserializeOwned>(
&self,
method: &str,
params: P,
) -> Result<R>
pub async fn call<P: Serialize, R: DeserializeOwned>( &self, method: &str, params: P, ) -> Result<R>
Send any CDP command in this session and deserialize its result into R.
let session = client.attach_to_target("A1B2C3").await?;
let _: Value = session
.call("Page.navigate", json!({ "url": "https://example.com" }))
.await?;Sourcepub async fn enable_domain(&self, domain: &str) -> Result<()>
pub async fn enable_domain(&self, domain: &str) -> Result<()>
Enable a CDP domain in this session, required before that target’s events for the domain start flowing.
Source§impl CdpSession<'_>
impl CdpSession<'_>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for CdpSession<'a>
impl<'a> !UnwindSafe for CdpSession<'a>
impl<'a> Forget for CdpSession<'a>
impl<'a> Freeze for CdpSession<'a>
impl<'a> Send for CdpSession<'a>
impl<'a> Sync for CdpSession<'a>
impl<'a> Unpin for CdpSession<'a>
impl<'a> UnsafeUnpin for CdpSession<'a>
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