pub struct NetworkManager {
pub ignore_visuals: bool,
pub block_stylesheets: bool,
pub block_javascript: bool,
pub block_analytics: bool,
pub only_html: bool,
pub intercept_manager: NetworkInterceptManager,
/* private fields */
}Fields§
§ignore_visuals: boolIgnore visuals (no pings, prefetching, and etc).
block_stylesheets: boolBlock CSS stylesheets.
block_javascript: boolBlock javascript that is not critical to rendering.
block_analytics: boolBlock analytics from rendering
only_html: boolOnly html from loading.
intercept_manager: NetworkInterceptManagerThe custom intercept handle logic to run on the website.
Implementations§
Source§impl NetworkManager
impl NetworkManager
pub fn new(ignore_httpserrors: bool, request_timeout: Duration) -> Self
pub fn init_commands(&self) -> CommandChain
Sourcepub fn poll(&mut self) -> Option<NetworkEvent>
pub fn poll(&mut self) -> Option<NetworkEvent>
The next event to handle
pub fn extra_headers(&self) -> &HashMap<String, String>
pub fn set_extra_headers(&mut self, headers: HashMap<String, String>)
pub fn set_service_worker_enabled(&mut self, bypass: bool)
pub fn set_request_interception(&mut self, enabled: bool)
pub fn set_cache_enabled(&mut self, enabled: bool)
pub fn update_protocol_cache_disabled(&mut self)
pub fn authenticate(&mut self, credentials: Credentials)
pub fn on_fetch_request_paused(&mut self, event: &EventRequestPaused)
pub fn on_fetch_auth_required(&mut self, event: &EventAuthRequired)
pub fn set_offline_mode(&mut self, value: bool)
Sourcepub fn on_request_will_be_sent(&mut self, event: &EventRequestWillBeSent)
pub fn on_request_will_be_sent(&mut self, event: &EventRequestWillBeSent)
Request interception doesn’t happen for data URLs with Network Service.
pub fn on_request_served_from_cache( &mut self, event: &EventRequestServedFromCache, )
pub fn on_response_received(&mut self, event: &EventResponseReceived)
pub fn on_network_loading_finished(&mut self, event: &EventLoadingFinished)
pub fn on_network_loading_failed(&mut self, event: &EventLoadingFailed)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NetworkManager
impl RefUnwindSafe for NetworkManager
impl Send for NetworkManager
impl Sync for NetworkManager
impl Unpin for NetworkManager
impl UnwindSafe for NetworkManager
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
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