pub struct WebView { /* private fields */ }Expand description
WebView type that includes inner implementation and delegate
Implementations§
Source§impl WebView
impl WebView
Sourcepub const fn native_view_id(&self) -> NativeWebViewId
pub const fn native_view_id(&self) -> NativeWebViewId
Opaque identity for this concrete native WebView instance.
It is readable for identity comparison across crates, but cannot be constructed, serialized, or converted to a raw platform handle by consumers.
Sourcepub fn prepare_trusted_data_load(
&self,
) -> Result<TrustedDataLoadReservation<'_>, WebViewError>
pub fn prepare_trusted_data_load( &self, ) -> Result<TrustedDataLoadReservation<'_>, WebViewError>
Reserve a trusted native HTML load before starting the native operation.
Register TrustedDataLoadReservation::intent with document state
before calling load; a native callback is permitted to arrive before
load returns. The reservation’s Drop implementation revokes an
unused token. HTML and base URLs are resource-location inputs, never
authority.
Sourcepub fn current_document_binding(&self) -> DocumentBinding
pub fn current_document_binding(&self) -> DocumentBinding
Read the document binding currently owned by this native WebView.
This is intentionally read-only. Only accepted top-level navigation starts and reliable commits in the event normalizer can change it.
Sourcepub fn has_scheme_handler(&self, scheme: &str) -> bool
pub fn has_scheme_handler(&self, scheme: &str) -> bool
Check if a scheme handler is registered for the given scheme.
Call the navigation handler. Returns Allow if no handler is registered.
A URL matching an open crate::url_callback channel is delivered to
that channel and cancelled before any per-webview handler runs.
Sourcepub fn has_new_window_handler(&self) -> bool
pub fn has_new_window_handler(&self) -> bool
Check if a new-window handler is registered.
Sourcepub fn handle_new_window(&self, url: &str) -> NewWindowPolicy
pub fn handle_new_window(&self, url: &str) -> NewWindowPolicy
Call the new-window handler. Returns Cancel if no handler is registered.
A URL matching an open crate::url_callback channel is delivered to
that channel and cancelled before any per-webview handler runs.
pub async fn evaluate_javascript( &self, js: &str, ) -> Result<Value, WebViewScriptError>
pub async fn current_url(&self) -> Result<Option<String>, WebViewError>
pub fn reload(&self) -> Result<(), WebViewError>
pub fn go_back(&self) -> Result<(), WebViewError>
pub fn go_forward(&self) -> Result<(), WebViewError>
pub async fn start_network_capture(&self) -> Result<(), WebViewError>
pub async fn stop_network_capture(&self) -> Result<(), WebViewError>
pub async fn network_entries( &self, ) -> Result<NetworkCaptureSnapshot, WebViewError>
pub async fn clear_network_capture(&self) -> Result<(), WebViewError>
pub async fn take_screenshot(&self) -> Result<Vec<u8>, WebViewError>
pub async fn click( &self, selector: &str, options: ClickOptions, ) -> Result<(), WebViewInputError>
pub async fn type_text( &self, selector: &str, text: &str, options: TypeOptions, ) -> Result<(), WebViewInputError>
pub async fn fill( &self, selector: &str, text: &str, options: FillOptions, ) -> Result<(), WebViewInputError>
pub async fn press( &self, key: &str, options: PressOptions, ) -> Result<(), WebViewInputError>
pub async fn scroll( &self, dx: f64, dy: f64, options: ScrollOptions, ) -> Result<(), WebViewInputError>
pub async fn scroll_to( &self, selector: &str, options: ScrollOptions, ) -> Result<(), WebViewInputError>
Trait Implementations§
Source§impl WebViewController for WebView
impl WebViewController for WebView
Source§fn load_data(&self, request: LoadDataRequest<'_>) -> Result<(), WebViewError>
fn load_data(&self, request: LoadDataRequest<'_>) -> Result<(), WebViewError>
Source§fn exec_js(&self, js: &str) -> Result<(), WebViewError>
fn exec_js(&self, js: &str) -> Result<(), WebViewError>
Source§fn eval_js<'life0, 'life1, 'async_trait>(
&'life0 self,
js: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Value, WebViewScriptError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn eval_js<'life0, 'life1, 'async_trait>(
&'life0 self,
js: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Value, WebViewScriptError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn current_url<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, WebViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn current_url<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, WebViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn post_message(&self, message: &str) -> Result<(), WebViewError>
fn post_message(&self, message: &str) -> Result<(), WebViewError>
Source§fn post_message_to_document(
&self,
expected_generation: DocumentGeneration,
gate: Arc<dyn DocumentOutboundGate>,
message: &str,
) -> Result<(), WebViewError>
fn post_message_to_document( &self, expected_generation: DocumentGeneration, gate: Arc<dyn DocumentOutboundGate>, message: &str, ) -> Result<(), WebViewError>
Source§fn clear_browsing_data(&self) -> Result<(), WebViewError>
fn clear_browsing_data(&self) -> Result<(), WebViewError>
Source§fn set_user_agent_override(
&self,
user_agent: UserAgentOverride,
) -> Result<(), WebViewError>
fn set_user_agent_override( &self, user_agent: UserAgentOverride, ) -> Result<(), WebViewError>
Source§fn go_forward(&self) -> Result<(), WebViewError>
fn go_forward(&self) -> Result<(), WebViewError>
Source§fn clear_site_data<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
options: ClearSiteDataOptions,
) -> Pin<Box<dyn Future<Output = Result<ClearSiteDataResult, WebViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn clear_site_data<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
options: ClearSiteDataOptions,
) -> Pin<Box<dyn Future<Output = Result<ClearSiteDataResult, WebViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn take_screenshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, WebViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn take_screenshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, WebViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn start_network_capture<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), WebViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start_network_capture<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), WebViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Self::network_entries. Dev-tooling only;
implemented on platforms whose WebView exposes an inspection protocol
(currently Windows/WebView2 via the Chrome DevTools Protocol).Source§fn stop_network_capture<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), WebViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop_network_capture<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), WebViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Self::clear_network_capture or the webview is torn down.Source§fn network_entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<NetworkCaptureSnapshot, WebViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn network_entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<NetworkCaptureSnapshot, WebViewError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
dropped counts
entries evicted from the ring buffer since the last clear.