pub struct WebView { /* private fields */ }Expand description
A webview based on wry WebView.
[experimental]
Implementations§
Methods from Deref<Target = WebView>§
Sourcepub fn evaluate_script_with_callback(
&self,
js: &str,
callback: impl Fn(String) + Send + 'static,
) -> Result<(), Error>
pub fn evaluate_script_with_callback( &self, js: &str, callback: impl Fn(String) + Send + 'static, ) -> Result<(), Error>
Evaluate and run javascript code with callback function. The evaluation result will be serialized into a JSON string and passed to the callback function.
Exception is ignored because of the limitation on windows. You can catch it yourself and return as string as a workaround.
- ** Android:** Not implemented yet.
Get a list of cookies for specific url.
Sourcepub fn open_devtools(&self)
pub fn open_devtools(&self)
Open the web inspector which is usually called dev tool.
§Platform-specific
- Android / iOS: Not supported.
Sourcepub fn close_devtools(&self)
pub fn close_devtools(&self)
Close the web inspector which is usually called dev tool.
§Platform-specific
- Windows / Android / iOS: Not supported.
Sourcepub fn is_devtools_open(&self) -> bool
pub fn is_devtools_open(&self) -> bool
Gets the devtool window’s current visibility state.
§Platform-specific
- Windows / Android / iOS: Not supported.
Sourcepub fn zoom(&self, scale_factor: f64) -> Result<(), Error>
pub fn zoom(&self, scale_factor: f64) -> Result<(), Error>
Set the webview zoom level
§Platform-specific:
- Android: Not supported.
- macOS: available on macOS 11+ only.
- iOS: available on iOS 14+ only.
Sourcepub fn set_background_color(
&self,
background_color: (u8, u8, u8, u8),
) -> Result<(), Error>
pub fn set_background_color( &self, background_color: (u8, u8, u8, u8), ) -> Result<(), Error>
Specify the webview background color.
The color uses the RGBA format.
§Platfrom-specific:
- macOS: Not implemented.
- Windows:
- On Windows 7, transparency is not supported and the alpha value will be ignored.
- On Windows higher than 7: translucent colors are not supported so any alpha value other than
0will be replaced by255
Sourcepub fn load_url_with_headers(
&self,
url: &str,
headers: HeaderMap,
) -> Result<(), Error>
pub fn load_url_with_headers( &self, url: &str, headers: HeaderMap, ) -> Result<(), Error>
Navigate to the specified url using the specified headers
Sourcepub fn clear_all_browsing_data(&self) -> Result<(), Error>
pub fn clear_all_browsing_data(&self) -> Result<(), Error>
Clear all browsing data
pub fn bounds(&self) -> Result<Rect, Error>
Sourcepub fn set_bounds(&self, bounds: Rect) -> Result<(), Error>
pub fn set_bounds(&self, bounds: Rect) -> Result<(), Error>
Set the webview bounds.
This is only effective if the webview was created as a child
or created using [WebViewBuilderExtUnix::new_gtk] with gtk::Fixed.
Trait Implementations§
impl EventEmitter<DismissEvent> for WebView
Source§impl Focusable for WebView
impl Focusable for WebView
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Auto Trait Implementations§
impl !RefUnwindSafe for WebView
impl !Send for WebView
impl !Sync for WebView
impl !UnwindSafe for WebView
impl Freeze for WebView
impl Unpin for WebView
impl UnsafeUnpin for WebView
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> 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