Struct WebView

Source
pub struct WebView<'a, T: 'a> { /* private fields */ }
Expand description

An owned webview instance.

Construct via a WebViewBuilder.

Implementations§

Source§

impl<'a, T> WebView<'a, T>

Source

pub fn handle(&self) -> Handle<T>

Creates a thread-safe Handle to the WebView, from which closures can be dispatched.

Source

pub fn user_data(&self) -> &T

Borrows the user data immutably.

Source

pub fn user_data_mut(&mut self) -> &mut T

Borrows the user data mutably.

Source

pub fn terminate(&mut self)

👎Deprecated: Please use exit instead
Source

pub fn exit(&mut self)

Gracefully exits the webview

Source

pub fn eval(&mut self, js: &str) -> WVResult

Executes the provided string as JavaScript code within the WebView instance.

Source

pub fn inject_css(&mut self, css: &str) -> WVResult

Injects the provided string as CSS within the WebView instance.

Source

pub fn set_color<C: Into<Color>>(&mut self, color: C)

Sets the color of the title bar.

§Examples

Without specifying alpha (defaults to 255):

webview.set_color((123, 321, 213));

Specifying alpha:

webview.set_color((123, 321, 213, 127));
Source

pub fn set_title(&mut self, title: &str) -> WVResult

Sets the title displayed at the top of the window.

§Errors

If title contain a nul byte, returns Error::NulByte.

Source

pub fn set_fullscreen(&mut self, fullscreen: bool)

Enables or disables fullscreen.

Source

pub fn dialog<'b>(&'b mut self) -> DialogBuilder<'a, 'b, T>

👎Deprecated: Please use crates like ‘tinyfiledialogs’ for dialog handling, see example in examples/dialog.rs

Returns a builder for opening a new dialog window.

Source

pub fn step(&mut self) -> Option<WVResult>

Iterates the event loop. Returns None if the view has been closed or terminated.

Source

pub fn run(self) -> WVResult<T>

Runs the event loop to completion and returns the user data.

Source

pub fn into_inner(self) -> T

Consumes the WebView and returns ownership of the user data.

Trait Implementations§

Source§

impl<'a, T: Debug + 'a> Debug for WebView<'a, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, T> Drop for WebView<'a, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for WebView<'a, T>

§

impl<'a, T> RefUnwindSafe for WebView<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> !Send for WebView<'a, T>

§

impl<'a, T> !Sync for WebView<'a, T>

§

impl<'a, T> Unpin for WebView<'a, T>

§

impl<'a, T> !UnwindSafe for WebView<'a, T>

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