tauri_runtime::webview

Struct PendingWebview

Source
pub struct PendingWebview<T: UserEvent, R: Runtime<T>> {
    pub label: String,
    pub webview_attributes: WebviewAttributes,
    pub uri_scheme_protocols: HashMap<String, Box<dyn Fn(&str, Request<Vec<u8>>, Box<dyn FnOnce(Response<Cow<'static, [u8]>>) + Send>) + Send + Sync + 'static>>,
    pub ipc_handler: Option<WebviewIpcHandler<T, R>>,
    pub navigation_handler: Option<Box<dyn Fn(&Url) -> bool + Send>>,
    pub url: String,
    pub web_resource_request_handler: Option<Box<dyn Fn(Request<Vec<u8>>, &mut Response<Cow<'static, [u8]>>) + Send + Sync>>,
    pub on_page_load_handler: Option<Box<dyn Fn(Url, PageLoadEvent) + Send>>,
    pub download_handler: Option<Arc<dyn Fn(DownloadEvent<'_>) -> bool + Send + Sync>>,
}
Expand description

A webview that has yet to be built.

Fields§

§label: String

The label that the webview will be named.

§webview_attributes: WebviewAttributes

The WebviewAttributes that the webview will be created with.

§uri_scheme_protocols: HashMap<String, Box<dyn Fn(&str, Request<Vec<u8>>, Box<dyn FnOnce(Response<Cow<'static, [u8]>>) + Send>) + Send + Sync + 'static>>§ipc_handler: Option<WebviewIpcHandler<T, R>>

How to handle IPC calls on the webview.

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

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

§url: String

The resolved URL to load on the webview.

§web_resource_request_handler: Option<Box<dyn Fn(Request<Vec<u8>>, &mut Response<Cow<'static, [u8]>>) + Send + Sync>>§on_page_load_handler: Option<Box<dyn Fn(Url, PageLoadEvent) + Send>>§download_handler: Option<Arc<dyn Fn(DownloadEvent<'_>) -> bool + Send + Sync>>

Implementations§

Source§

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

Source

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

Create a new PendingWebview with a label from the given WebviewAttributes.

Source

pub fn register_uri_scheme_protocol<N: Into<String>, H: Fn(&str, Request<Vec<u8>>, Box<dyn FnOnce(Response<Cow<'static, [u8]>>) + Send>) + Send + Sync + 'static>( &mut self, uri_scheme: N, protocol: H, )

Auto Trait Implementations§

§

impl<T, R> Freeze for PendingWebview<T, R>

§

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

§

impl<T, R> Send for PendingWebview<T, R>

§

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

§

impl<T, R> Unpin for PendingWebview<T, R>

§

impl<T, R> !UnwindSafe for PendingWebview<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>,

Source§

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>,

Source§

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<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T