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§
Source§impl Focusable for WebView
impl Focusable for WebView
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
impl EventEmitter<DismissEvent> for WebView
Auto Trait Implementations§
impl Freeze for WebView
impl !RefUnwindSafe for WebView
impl !Send for WebView
impl !Sync for WebView
impl Unpin for WebView
impl !UnwindSafe 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
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>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<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>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> 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)
&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)
&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> 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