Struct tauri_runtime::window::PendingWindow

source ·
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(&Request) -> Result<Response, Box<dyn Error>> + Send + Sync + 'static>>,
    pub http_scheme: bool,
    pub ipc_handler: Option<WebviewIpcHandler<T, R>>,
    pub menu_ids: Arc<Mutex<HashMap<MenuHash, MenuId>>>,
    pub js_event_listeners: Arc<Mutex<HashMap<JsEventListenerKey, HashSet<u32>>>>,
    pub navigation_handler: Option<Box<dyn Fn(Url) -> bool + Send>>,
    pub web_resource_request_handler: Option<Box<dyn Fn(&Request, &mut Response) + Send + Sync>>,
    pub url: String,
}
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(&Request) -> Result<Response, Box<dyn Error>> + Send + Sync + 'static>>§http_scheme: bool§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<u32>>>>

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.

§web_resource_request_handler: Option<Box<dyn Fn(&Request, &mut Response) + Send + Sync>>§url: String

The resolved URL to load on the webview.

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> Freeze for PendingWindow<T, R>
where <<R as Runtime<T>>::Dispatcher as Dispatch<T>>::WindowBuilder: Freeze,

§

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 T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where 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 T
where 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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V