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 on_webview_created: Option<Box<dyn Fn(CreationContext<'_, '_>) -> Result<(), Error> + Send>>,
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.
A handler to decide if incoming url is allowed to navigate.
url: String
The resolved URL to load on the webview.
on_webview_created: Option<Box<dyn Fn(CreationContext<'_, '_>) -> Result<(), Error> + Send>>
§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>
impl<T: UserEvent, R: Runtime<T>> PendingWebview<T, R>
Sourcepub fn new(
webview_attributes: WebviewAttributes,
label: impl Into<String>,
) -> Result<Self>
pub fn new( webview_attributes: WebviewAttributes, label: impl Into<String>, ) -> Result<Self>
Create a new PendingWebview
with a label from the given WebviewAttributes
.
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, )
pub fn on_webview_created<F: Fn(CreationContext<'_, '_>) -> Result<(), Error> + Send + 'static>( self, f: F, ) -> Self
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more