Struct tauri_runtime::webview::WebviewAttributes [−][src]
pub struct WebviewAttributes {
pub url: WindowUrl,
pub initialization_scripts: Vec<String>,
pub data_directory: Option<PathBuf>,
pub uri_scheme_protocols: HashMap<String, Box<dyn Fn(&str) -> Result<Vec<u8>, Box<dyn Error>> + Send + Sync + 'static>>,
}Expand description
The attributes used to create an webview.
Fields
url: WindowUrlinitialization_scripts: Vec<String>data_directory: Option<PathBuf>uri_scheme_protocols: HashMap<String, Box<dyn Fn(&str) -> Result<Vec<u8>, Box<dyn Error>> + Send + Sync + 'static>>Implementations
impl WebviewAttributes[src]
impl WebviewAttributes[src]pub fn initialization_script(self, script: &str) -> Self[src]
pub fn initialization_script(self, script: &str) -> Self[src]Sets the init script.
pub fn data_directory(self, data_directory: PathBuf) -> Self[src]
pub fn data_directory(self, data_directory: PathBuf) -> Self[src]Data directory for the webview.
pub fn has_uri_scheme_protocol(&self, name: &str) -> bool[src]
pub fn has_uri_scheme_protocol(&self, name: &str) -> bool[src]Whether the webview URI scheme protocol is defined or not.
pub fn register_uri_scheme_protocol<N: Into<String>, H: Fn(&str) -> Result<Vec<u8>, Box<dyn Error>> + Send + Sync + 'static>(
self,
uri_scheme: N,
protocol: H
) -> Self[src]
pub fn register_uri_scheme_protocol<N: Into<String>, H: Fn(&str) -> Result<Vec<u8>, Box<dyn Error>> + Send + Sync + 'static>(
self,
uri_scheme: N,
protocol: H
) -> Self[src]Registers a webview protocol handler. Leverages setURLSchemeHandler on macOS, AddWebResourceRequestedFilter on Windows and webkit-web-context-register-uri-scheme on Linux.
Arguments
uri_schemeThe URI scheme to register, such asexample.protocolthe protocol associated with the given URI scheme. It’s a function that takes an URL such asexample://localhost/asset.css.
Auto Trait Implementations
impl !RefUnwindSafe for WebviewAttributes
impl Send for WebviewAttributes
impl Sync for WebviewAttributes
impl Unpin for WebviewAttributes
impl !UnwindSafe for WebviewAttributes
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T