pub struct CaptureHub { /* private fields */ }Expand description
The capture hub. Cheap to clone via Arc on ServerState.
Implementations§
Source§impl CaptureHub
impl CaptureHub
pub fn new() -> Self
Sourcepub fn touch(&self, backend: &TabBackend, target_id: &str)
pub fn touch(&self, backend: &TabBackend, target_id: &str)
Start capturing target_id if not already. Synchronous and
non-blocking: the attach (CDP) or subscribe + seed (BiDi) runs on a
background task.
Sourcepub async fn touch_and_wait(&self, backend: &TabBackend, target_id: &str)
pub async fn touch_and_wait(&self, backend: &TabBackend, target_id: &str)
touch, then wait (bounded by TOUCH_WAIT) until the tab’s
domains are enabled so events from the caller’s next action are
captured. Never errors.
Sourcepub fn forget(&self, backend: &TabBackend, target_id: &str)
pub fn forget(&self, backend: &TabBackend, target_id: &str)
Drop the state for a closed tab and detach the hub session.
Sourcepub fn reset(&self)
pub fn reset(&self)
Forget everything (browser switch). No RPCs: dropping the backend closes the socket, and the browser discards its sessions and subscriptions.
Sourcepub fn captured_tabs(&self) -> Vec<String>
pub fn captured_tabs(&self) -> Vec<String>
Number of tabs currently captured (diagnostics / tests).
Sourcepub async fn read_console(
&self,
target_id: &str,
q: &ConsoleQuery,
) -> Result<ConsoleReport>
pub async fn read_console( &self, target_id: &str, q: &ConsoleQuery, ) -> Result<ConsoleReport>
Read (and optionally clear) the console buffer of a tab.
Sourcepub async fn read_network(
&self,
target_id: &str,
q: &NetworkQuery,
) -> Result<NetworkReport>
pub async fn read_network( &self, target_id: &str, q: &NetworkQuery, ) -> Result<NetworkReport>
Read (and optionally clear) the network buffer of a tab.
Sourcepub async fn response_body(
&self,
backend: &TabBackend,
target_id: &str,
request_id: &str,
max_bytes: usize,
timeout: Duration,
) -> Result<BodyResult>
pub async fn response_body( &self, backend: &TabBackend, target_id: &str, request_id: &str, max_bytes: usize, timeout: Duration, ) -> Result<BodyResult>
Fetch a captured response body through the hub’s session.
Trait Implementations§
Source§impl Default for CaptureHub
impl Default for CaptureHub
Source§impl Drop for CaptureHub
impl Drop for CaptureHub
Auto Trait Implementations§
impl Freeze for CaptureHub
impl RefUnwindSafe for CaptureHub
impl Send for CaptureHub
impl Sync for CaptureHub
impl Unpin for CaptureHub
impl UnsafeUnpin for CaptureHub
impl UnwindSafe for CaptureHub
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more