Struct BrowserWindowOwner

Source
pub struct BrowserWindowOwner(/* private fields */);
Expand description

An owned browser window handle. When this handle goes out of scope, its resources will get scheduled for cleanup. The resources will only ever be cleaned up whenever both this handle has gone out of scope, and when the window has actually been closed by the user. If the window has been closed by the user but this handle still exists, the window is actually just been closed. It can be reshown by calling show on this handle.

Methods from Deref<Target = BrowserWindowHandle>§

Source

pub fn app(&self) -> ApplicationHandle

Returns the application handle associated with this browser window.

Source

pub async fn eval_js(&self, js: &str) -> Result<JsValue, JsEvaluationError>

Executes the given javascript code and returns the output as a string. If you don’t need the result, see exec_js.

There may be some discrepancies in what JS values are being returned for the same code in different browser engines, or how accurate they are. For example, Edge WebView2 doesn’t return JsValue::Undefined, it uses JsValue::Null instead.

Source

pub fn exec_js(&self, js: &str)

Executes the given javascript code without waiting on it to finish.

Source

pub fn navigate(&self, url: &str)

Causes the browser to navigate to the given url.

Source

pub fn url<'a>(&'a self) -> Cow<'a, str>

Source

pub fn window(&self) -> &WindowHandle

Methods from Deref<Target = WindowHandle>§

Source

pub fn content_dimensions(&self) -> Dims2D

Source

pub fn opacity(&self) -> u8

Source

pub fn position(&self) -> Pos2D

Source

pub fn title(&self) -> String

Source

pub fn window_dimensions(&self) -> Dims2D

Source

pub fn hide(&self)

Hides the window. Keep in mind that hiding the window is not the same as closing it. Hiding the window will keep it’s resources alive. If the window is hidden, and all window handles are gone, the memory is effectively leaked.

Source

pub fn set_content_dimensions(&self, dimensions: Dims2D)

Source

pub fn set_opacity(&self, opacity: u8)

Source

pub fn set_position(&self, position: Pos2D)

Source

pub fn set_title(&self, title: &str)

Source

pub fn set_window_dimensions(&self, dimensions: Dims2D)

Source

pub fn show(&self)

Shows a window if it was hidden. Windows that were just created are hidden to start. This method is necessary to show it to the user.

Trait Implementations§

Source§

impl Drop for BrowserWindowOwner

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Deref for BrowserWindowOwner

Source§

type Target = BrowserWindowHandle

The resulting type after dereferencing.
Source§

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

Dereferences the value.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<H> HasHandle<H> for H

Source§

fn handle(&self) -> &H

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V