pub struct NetworkHandle { /* private fields */ }Available on crate feature
cdp only.Expand description
tab.network() 返回的链式句柄。
Implementations§
Source§impl NetworkHandle
impl NetworkHandle
Sourcepub fn method(self, method: impl Into<String>) -> Self
pub fn method(self, method: impl Into<String>) -> Self
仅匹配该 HTTP 方法(可多次,OR;POST / GET …,大小写不敏感)。
Sourcepub async fn listen(self) -> Result<CdpListen>
pub async fn listen(self) -> Result<CdpListen>
开始监听,返回既有 CdpListen(可 wait / wait_count / stop)。
Sourcepub async fn intercept(self) -> Result<CdpIntercept>
pub async fn intercept(self) -> Result<CdpIntercept>
开始拦截,匹配项交调用方 next() 决策。
Sourcepub async fn block(self) -> Result<NetworkRoute>
pub async fn block(self) -> Result<NetworkRoute>
匹配的请求一律中止(blockedbyclient);不匹配自动放行。
Sourcepub async fn mock(
self,
status: u16,
headers: Vec<(String, String)>,
body: impl Into<String>,
) -> Result<NetworkRoute>
pub async fn mock( self, status: u16, headers: Vec<(String, String)>, body: impl Into<String>, ) -> Result<NetworkRoute>
匹配的请求用伪造响应满足(不打到真实服务器)。
Sourcepub async fn rewrite(self, opts: ResumeOptions) -> Result<NetworkRoute>
pub async fn rewrite(self, opts: ResumeOptions) -> Result<NetworkRoute>
匹配的请求改写后放行。
Sourcepub async fn record(self) -> Result<HarRecorder>
pub async fn record(self) -> Result<HarRecorder>
HAR 录制(委托既有 har_record)。
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for NetworkHandle
impl !UnwindSafe for NetworkHandle
impl Freeze for NetworkHandle
impl Send for NetworkHandle
impl Sync for NetworkHandle
impl Unpin for NetworkHandle
impl UnsafeUnpin for NetworkHandle
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for 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> ⓘ
Converts
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> ⓘ
Converts
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