pub struct NetworkManager {
pub request_timeout: Duration,
pub ignore_visuals: bool,
pub block_stylesheets: bool,
pub block_javascript: bool,
pub block_analytics: bool,
pub only_html: bool,
pub xml_document: bool,
pub intercept_manager: NetworkInterceptManager,
pub document_reload_tracker: u8,
pub document_target_domain: String,
pub max_bytes_allowed: Option<u64>,
/* private fields */
}Expand description
The base network manager.
Fields§
§request_timeout: DurationThe page request timeout.
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.
xml_document: boolIs xml document?
intercept_manager: NetworkInterceptManagerThe custom intercept handle logic to run on the website.
document_reload_tracker: u8Track the amount of times the document reloaded.
document_target_domain: StringThe initial target domain.
max_bytes_allowed: Option<u64>The max bytes to receive.
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_block_all(&mut self, block_all: bool)
pub fn set_request_interception(&mut self, enabled: bool)
pub fn set_cache_enabled(&mut self, enabled: bool)
pub fn disable_request_intercept(&mut self)
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, )
Sourcepub fn on_response_received(&mut self, event: &EventResponseReceived)
pub fn on_response_received(&mut self, event: &EventResponseReceived)
On network response received.
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