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

pub struct BrowserWindowBuilder { /* fields omitted */ }
Expand description

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

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.

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.

Creates an instance of a browser window builder.

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

Creates the browser window.

Arguments
  • app - An application handle that this browser window can spawn into

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 ) -> Result<BrowserWindowThreaded, DelegateError> { /* ... */ }
Arguments
  • app - An (thread-safe) application handle.

Methods from Deref<Target = WindowBuilder>

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

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

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

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.

Sets the width and height of the browser window

Sets the title of the window.

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

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

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.