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]

pub fn new(url: WindowUrl) -> Self[src]

Initializes the default attributes for a webview.

pub fn initialization_script(self, script: &str) -> Self[src]

Sets the init script.

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]

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]

Registers a webview protocol handler. Leverages setURLSchemeHandler on macOS, AddWebResourceRequestedFilter on Windows and webkit-web-context-register-uri-scheme on Linux.

Arguments

  • uri_scheme The URI scheme to register, such as example.
  • protocol the protocol associated with the given URI scheme. It’s a function that takes an URL such as example://localhost/asset.css.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.