Struct browser_window::browser::BrowserWindowBuilder [−][src]
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]
H: FnMut(BrowserWindowHandle, String, Vec<String>) -> F + Send + 'static,
F: Future<Output = ()> + 'static,
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]
self,
app: ApplicationHandleThreaded
) -> Result<BrowserWindowThreaded, DelegateError>
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]
W: OwnedWindow,
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.
fn deref(&self) -> &Self::Target
[src]
impl DerefMut for BrowserWindowBuilder
[src]
Auto Trait Implementations
impl !RefUnwindSafe for BrowserWindowBuilder
impl Send for BrowserWindowBuilder
impl !Sync for BrowserWindowBuilder
impl Unpin for BrowserWindowBuilder
impl !UnwindSafe for BrowserWindowBuilder
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,
pub 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.
pub 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>,