pub struct NetworkLog { /* private fields */ }Implementations§
Source§impl NetworkLog
impl NetworkLog
pub fn new() -> NetworkLog
pub fn with_limits(max_entries: usize, max_pending: usize) -> NetworkLog
pub async fn subscribe(&self) -> Receiver<Arc<NetworkEntry>>
pub async fn entries(&self) -> Vec<Arc<NetworkEntry>>
pub async fn completed(&self) -> Vec<Arc<NetworkEntry>>
pub async fn count(&self, filter: Filter) -> usize
pub async fn filter(&self, f: Filter) -> Vec<Arc<NetworkEntry>>
pub async fn first(&self) -> Option<Arc<NetworkEntry>>
pub async fn last(&self) -> Option<Arc<NetworkEntry>>
pub async fn nth(&self, n: usize) -> Option<Arc<NetworkEntry>>
pub async fn find_by_url(&self, substring: &str) -> Option<Arc<NetworkEntry>>
pub async fn find_by_url_regex(&self, re: &Regex) -> Option<Arc<NetworkEntry>>
pub async fn endpoints(&self) -> Vec<String>
pub async fn hostnames(&self) -> Vec<String>
pub async fn distinct_methods(&self) -> Vec<String>
pub async fn distinct_statuses(&self) -> Vec<u16>
pub async fn total_bytes_in(&self) -> u64
pub async fn total_bytes_out(&self) -> u64
pub async fn len(&self) -> usize
pub async fn is_empty(&self) -> bool
pub async fn clear(&self)
pub async fn metrics(&self) -> NetworkMetrics
pub async fn contains_id(&self, id: &str) -> bool
pub async fn remove_by_id(&self, id: &str) -> Option<Arc<NetworkEntry>>
Sourcepub async fn request_ids(&self) -> Vec<String>
pub async fn request_ids(&self) -> Vec<String>
Return all captured request IDs in chronological order.
Sourcepub async fn memory_estimate(&self) -> usize
pub async fn memory_estimate(&self) -> usize
Return an approximate memory footprint in bytes. Useful for monitoring and backpressure decisions.
Sourcepub async fn has_response(&self, id: &str) -> bool
pub async fn has_response(&self, id: &str) -> bool
Return whether the entry with id has a response.
Sourcepub async fn pending_count(&self) -> usize
pub async fn pending_count(&self) -> usize
Return the number of out-of-order responses/errors stashed in pending maps (orphaned entries waiting for their request).
Sourcepub async fn drain_pending(&self) -> (Vec<CapturedResponse>, Vec<CapturedError>)
pub async fn drain_pending(&self) -> (Vec<CapturedResponse>, Vec<CapturedError>)
Drain all orphaned pending responses and errors, returning them. Useful for preventing unbounded growth when requests never arrive (e.g. page navigation interrupts the request lifecycle).
Sourcepub async fn retain<F>(&self, f: F)
pub async fn retain<F>(&self, f: F)
Retain only entries that satisfy the predicate.
More efficient than repeated remove_by_id for bulk filtering.
Sourcepub async fn wait_for_url(
&self,
substring: &str,
timeout: Duration,
) -> Option<Arc<NetworkEntry>>
pub async fn wait_for_url( &self, substring: &str, timeout: Duration, ) -> Option<Arc<NetworkEntry>>
Wait up to timeout for an entry whose request URL contains substring.
Sourcepub async fn wait_for_response(
&self,
id: &str,
timeout: Duration,
) -> Option<Arc<NetworkEntry>>
pub async fn wait_for_response( &self, id: &str, timeout: Duration, ) -> Option<Arc<NetworkEntry>>
Wait up to timeout for a response to the given request id.
Sourcepub async fn find_by_status(&self, status: u16) -> Vec<Arc<NetworkEntry>>
pub async fn find_by_status(&self, status: u16) -> Vec<Arc<NetworkEntry>>
Return all entries with the given HTTP status code.
Sourcepub async fn entries_since(&self, timestamp: u64) -> Vec<Arc<NetworkEntry>>
pub async fn entries_since(&self, timestamp: u64) -> Vec<Arc<NetworkEntry>>
Return entries whose request timestamp is >= the given value.
Sourcepub async fn last_n(&self, n: usize) -> Vec<Arc<NetworkEntry>>
pub async fn last_n(&self, n: usize) -> Vec<Arc<NetworkEntry>>
Return the most recent n entries.
Sourcepub async fn unique_urls(&self) -> Vec<String>
pub async fn unique_urls(&self) -> Vec<String>
Return a deduplicated list of every captured request URL.
pub async fn save_to_json(&self, path: &Path) -> Result<(), Error>
Trait Implementations§
Source§impl Clone for NetworkLog
impl Clone for NetworkLog
Source§fn clone(&self) -> NetworkLog
fn clone(&self) -> NetworkLog
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NetworkLog
impl Debug for NetworkLog
Source§impl Default for NetworkLog
impl Default for NetworkLog
Source§fn default() -> NetworkLog
fn default() -> NetworkLog
Auto Trait Implementations§
impl !RefUnwindSafe for NetworkLog
impl !UnwindSafe for NetworkLog
impl Freeze for NetworkLog
impl Send for NetworkLog
impl Sync for NetworkLog
impl Unpin for NetworkLog
impl UnsafeUnpin for NetworkLog
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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