tauri_runtime_wry

Struct WebviewWrapper

Source
pub struct WebviewWrapper { /* private fields */ }

Methods from Deref<Target = WebView>§

Source

pub fn id(&self) -> &str

Returns the id of this webview.

Source

pub fn url(&self) -> Result<String, Error>

Get the current url of the webview

Source

pub fn evaluate_script(&self, js: &str) -> Result<(), Error>

Evaluate and run javascript code.

Source

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.
Source

pub fn print(&self) -> Result<(), Error>

Launch print modal for the webview content.

Source

pub fn cookies_for_url(&self, url: &str) -> Result<Vec<Cookie<'static>>, Error>

Get a list of cookies for specific url.

Source

pub fn cookies(&self) -> Result<Vec<Cookie<'static>>, Error>

Get the list of cookies.

§Platform-specific
  • Android: Unsupported, always returns an empty Vec.
Source

pub fn open_devtools(&self)

Open the web inspector which is usually called dev tool.

§Platform-specific
  • Android / iOS: Not supported.
Source

pub fn close_devtools(&self)

Close the web inspector which is usually called dev tool.

§Platform-specific
  • Windows / Android / iOS: Not supported.
Source

pub fn is_devtools_open(&self) -> bool

Gets the devtool window’s current visibility state.

§Platform-specific
  • Windows / Android / iOS: Not supported.
Source

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.
Source

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 / iOS: 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 0 will be replaced by 255
Source

pub fn load_url(&self, url: &str) -> Result<(), Error>

Navigate to the specified url

Source

pub fn load_url_with_headers( &self, url: &str, headers: HeaderMap, ) -> Result<(), Error>

Navigate to the specified url using the specified headers

Source

pub fn load_html(&self, html: &str) -> Result<(), Error>

Load html content into the webview

Source

pub fn clear_all_browsing_data(&self) -> Result<(), Error>

Clear all browsing data

Source

pub fn bounds(&self) -> Result<Rect, Error>

Source

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.

Source

pub fn set_visible(&self, visible: bool) -> Result<(), Error>

Shows or hides the webview.

Source

pub fn focus(&self) -> Result<(), Error>

Try moving focus to the webview.

Source

pub fn focus_parent(&self) -> Result<(), Error>

Try moving focus away from the webview back to the parent window.

§Platform-specific:
  • Android: Not implemented.

Trait Implementations§

Source§

impl Clone for WebviewWrapper

Source§

fn clone(&self) -> WebviewWrapper

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Deref for WebviewWrapper

Source§

type Target = WebView

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Drop for WebviewWrapper

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T