[−][src]Struct web_view::WebViewBuilder
Builder for constructing a WebView
instance.
Example
extern crate web_view; use web_view::*; fn main() { WebViewBuilder::new() .title("Minimal webview example") .content(Content::Url("https://en.m.wikipedia.org/wiki/Main_Page")) .size(800, 600) .resizable(true) .debug(true) .user_data(()) .invoke_handler(|_webview, _arg| Ok(())) .build() .unwrap() .run() .unwrap(); }
Fields
title: &'a str
content: Option<Content<C>>
width: i32
height: i32
resizable: bool
debug: bool
invoke_handler: Option<I>
user_data: Option<T>
frameless: bool
Implementations
impl<'a, T: 'a, I, C> WebViewBuilder<'a, T, I, C> where
I: FnMut(&mut WebView<T>, &str) -> WVResult + 'a,
C: AsRef<str>,
[src]
I: FnMut(&mut WebView<T>, &str) -> WVResult + 'a,
C: AsRef<str>,
pub fn new() -> Self
[src]
Alias for WebViewBuilder::default()
.
pub fn title(self, title: &'a str) -> Self
[src]
Sets the title of the WebView window.
Defaults to "Application"
.
pub fn content(self, content: Content<C>) -> Self
[src]
Sets the content of the WebView. Either a URL or a HTML string.
pub fn size(self, width: i32, height: i32) -> Self
[src]
Sets the size of the WebView window.
Defaults to 800 x 600.
pub fn resizable(self, resizable: bool) -> Self
[src]
Sets the resizability of the WebView window. If set to false, the window cannot be resized.
Defaults to true
.
pub fn debug(self, debug: bool) -> Self
[src]
Enables or disables debug mode.
Defaults to true
for debug builds, false
for release builds.
pub fn frameless(self, frameless: bool) -> Self
[src]
The window crated will be frameless
defaults to false
pub fn invoke_handler(self, invoke_handler: I) -> Self
[src]
Sets the invoke handler callback. This will be called when a message is received from JavaScript.
Errors
If the closure returns an Err
, it will be returned on the next call to step()
.
pub fn user_data(self, user_data: T) -> Self
[src]
Sets the initial state of the user data. This is an arbitrary value stored on the WebView thread, accessible from dispatched closures without synchronization overhead.
pub fn build(self) -> WVResult<WebView<'a, T>>
[src]
Validates provided arguments and returns a new WebView if successful.
pub fn run(self) -> WVResult<T>
[src]
Validates provided arguments and runs a new WebView to completion, returning the user data.
Equivalent to build()?.run()
.
Trait Implementations
impl<'a, T: 'a, I, C> Default for WebViewBuilder<'a, T, I, C> where
I: FnMut(&mut WebView<T>, &str) -> WVResult + 'a,
C: AsRef<str>,
[src]
I: FnMut(&mut WebView<T>, &str) -> WVResult + 'a,
C: AsRef<str>,
Auto Trait Implementations
impl<'a, T, I, C> RefUnwindSafe for WebViewBuilder<'a, T, I, C> where
C: RefUnwindSafe,
I: RefUnwindSafe,
T: RefUnwindSafe,
C: RefUnwindSafe,
I: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, I, C> Send for WebViewBuilder<'a, T, I, C> where
C: Send,
I: Send,
T: Send,
C: Send,
I: Send,
T: Send,
impl<'a, T, I, C> Sync for WebViewBuilder<'a, T, I, C> where
C: Sync,
I: Sync,
T: Sync,
C: Sync,
I: Sync,
T: Sync,
impl<'a, T, I, C> Unpin for WebViewBuilder<'a, T, I, C> where
C: Unpin,
I: Unpin,
T: Unpin,
C: Unpin,
I: Unpin,
T: Unpin,
impl<'a, T, I, C> UnwindSafe for WebViewBuilder<'a, T, I, C> where
C: UnwindSafe,
I: UnwindSafe,
T: UnwindSafe,
C: UnwindSafe,
I: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,