pub struct PendingWindow<T: UserEvent, R: Runtime<T>> {
    pub label: String,
    pub window_builder: <R::Dispatcher as Dispatch<T>>::WindowBuilder,
    pub webview_attributes: WebviewAttributes,
    pub uri_scheme_protocols: HashMap<String, Box<dyn Fn(&HttpRequest) -> Result<HttpResponse, Box<dyn Error>> + Send + Sync + 'static>>,
    pub ipc_handler: Option<WebviewIpcHandler<T, R>>,
    pub menu_ids: Arc<Mutex<HashMap<MenuHash, MenuId>>>,
    pub js_event_listeners: Arc<Mutex<HashMap<JsEventListenerKey, HashSet<u64>>>>,
    pub navigation_handler: Option<Box<dyn Fn(Url) -> bool + Send>>,
    pub current_url: Arc<Mutex<Url>>,
}
Expand description

A webview window that has yet to be built.

Fields§

§label: String

The label that the window will be named.

§window_builder: <R::Dispatcher as Dispatch<T>>::WindowBuilder

The WindowBuilder that the window will be created with.

§webview_attributes: WebviewAttributes

The WebviewAttributes that the webview will be created with.

§uri_scheme_protocols: HashMap<String, Box<dyn Fn(&HttpRequest) -> Result<HttpResponse, Box<dyn Error>> + Send + Sync + 'static>>§ipc_handler: Option<WebviewIpcHandler<T, R>>

How to handle IPC calls on the webview window.

§menu_ids: Arc<Mutex<HashMap<MenuHash, MenuId>>>

Maps runtime id to a string menu id.

§js_event_listeners: Arc<Mutex<HashMap<JsEventListenerKey, HashSet<u64>>>>

A HashMap mapping JS event names with associated listener ids.

§navigation_handler: Option<Box<dyn Fn(Url) -> bool + Send>>

A handler to decide if incoming url is allowed to navigate.

§current_url: Arc<Mutex<Url>>

The current webview URL.

Implementations§

source§

impl<T: UserEvent, R: Runtime<T>> PendingWindow<T, R>

source

pub fn new( window_builder: <R::Dispatcher as Dispatch<T>>::WindowBuilder, webview_attributes: WebviewAttributes, label: impl Into<String> ) -> Result<Self>

Create a new PendingWindow with a label and starting url.

source

pub fn with_config( window_config: WindowConfig, webview_attributes: WebviewAttributes, label: impl Into<String> ) -> Result<Self>

Create a new PendingWindow from a WindowConfig with a label and starting url.

source

pub fn set_menu(self, menu: Menu) -> Self

source

pub fn register_uri_scheme_protocol<N: Into<String>, H: Fn(&HttpRequest) -> Result<HttpResponse, Box<dyn Error>> + Send + Sync + 'static>( &mut self, uri_scheme: N, protocol: H )

Auto Trait Implementations§

§

impl<T, R> !RefUnwindSafe for PendingWindow<T, R>

§

impl<T, R> Send for PendingWindow<T, R>where <<R as Runtime<T>>::Dispatcher as Dispatch<T>>::WindowBuilder: Send,

§

impl<T, R> !Sync for PendingWindow<T, R>

§

impl<T, R> Unpin for PendingWindow<T, R>where <<R as Runtime<T>>::Dispatcher as Dispatch<T>>::WindowBuilder: Unpin,

§

impl<T, R> !UnwindSafe for PendingWindow<T, R>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.