Struct browser_window::browser::BrowserWindowBuilder[][src]

pub struct BrowserWindowBuilder { /* fields omitted */ }

Used to create a BrowserWindow or BrowserWindowThreaded instance, depending on whether or not you have feature threadsafe enabled.

Warning

BrowserWindowBuilder dereferences to WindowBuilder, so that you can modify anything related to the window as well. This comes with a catch though. If you call any functions from WindowBuilder, they return a reference to WindowBuilder. So the following doesn’t work:

let bwb = BrowserWindowBuilder::new( Source::Url("https://www.duckduckgo.com".into()) )
	.title("DuckDuckGo")
	.dev_tools(true);

This is because the call to title returns a reference to WindowBuilder, which doesn’t have a method dev_tools.

The following is also wrong:

let bw = BrowserWindowBuilder::new( Source::Url("https://www.duckduckgo.com".into()) )
	.dev_tools(true)
	.title("DuckDuckGo")
	.build( app );

This is because Browser Window currently does not support creating windows that don’t have browsers in them. build is a method of BrowserWindowBuilder, yet title returns a reference to WindowBuilder, which has no build method.

The solution is to do this:

let mut bwb = BrowserWindowBuilder::new( Source::Url("https://www.duckduckgo.com".into()) )
	.dev_tools(true);
bwb.title("DuckDuckGo");
let bw = bwb.build( app );

Implementations

impl BrowserWindowBuilder[src]

pub fn async_handler<H, F>(&mut self, handler: H) -> &mut Self where
    H: FnMut(BrowserWindowHandle, String, Vec<String>) -> F + Send + 'static,
    F: Future<Output = ()> + 'static, 
[src]

Configure a closure that can be invoked from within JavaScript. The closure’s second parameter specifies a command name. The closure’s third parameter specifies an array of string arguments.

pub fn dev_tools(&mut self, enabled: bool) -> &mut Self[src]

Sets whether or not an extra window with developer tools will be opened together with this browser. When in debug mode the default is true. When in release mode the default is false.

pub fn new(source: Source) -> Self[src]

Creates an instance of a browser window builder.

Arguments

  • source - The content that will be displayed in the browser window.

pub async fn build(
    self,
    app: ApplicationHandleThreaded
) -> Result<BrowserWindowThreaded, DelegateError>
[src]

Creates the browser window.

Keep in mind that the description of this function is for when feature threadsafe is enabled. When it is not enabled, it looks like this:

pub async fn build( self, app: ApplicationHandle ) -> BrowserWindow { /* ... */ }

Arguments

  • app - An (thread-safe) application handle.

Methods from Deref<Target = WindowBuilder>

pub fn borders(&mut self, value: bool) -> &mut Self[src]

Sets whether or not the window has borders. Default is true.

pub fn height(&mut self, height: u32) -> &mut Self[src]

Sets the height that the browser window will be created with initially

pub fn minimizable(&mut self, value: bool) -> &mut Self[src]

Sets whether or not the window has a minimize button on the title bar Default is true

pub fn parent<W>(&mut self, bw: &W) -> &mut Self where
    W: OwnedWindow
[src]

Sets the opacity of the window. An opacity of 255 is the default and means the window is fully visible. An lower opacity means the window will be transparent. Configure a parent window. When a parent window closes, this browser window will close as well. This could be a reference to a Browser or BrowserThreaded handle.

pub fn size(&mut self, width: u32, height: u32) -> &mut Self[src]

Sets the width and height of the browser window

pub fn title<S: Into<String>>(&mut self, title: S) -> &mut Self[src]

Sets the title of the window.

pub fn width(&mut self, width: u32) -> &mut Self[src]

Sets the width that the browser window will be created with initially.

pub fn resizable(&mut self, resizable: bool) -> &mut Self[src]

Sets whether or not the window will be resizable. Default is true.

Trait Implementations

impl Deref for BrowserWindowBuilder[src]

type Target = WindowBuilder

The resulting type after dereferencing.

impl DerefMut for BrowserWindowBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.