Trait tauri::runtime::webview::Attributes[][src]

pub trait Attributes: AttributesBase {
    type Icon: TryFrom<Icon, Error = Error>;
Show methods fn new() -> Self;
fn with_config(config: WindowConfig) -> Self;
fn initialization_script(self, init: &str) -> Self;
fn x(self, x: f64) -> Self;
fn y(self, y: f64) -> Self;
fn width(self, width: f64) -> Self;
fn height(self, height: f64) -> Self;
fn min_width(self, min_width: f64) -> Self;
fn min_height(self, min_height: f64) -> Self;
fn max_width(self, max_width: f64) -> Self;
fn max_height(self, max_height: f64) -> Self;
fn resizable(self, resizable: bool) -> Self;
fn title<S: Into<String>>(self, title: S) -> Self;
fn fullscreen(self, fullscreen: bool) -> Self;
fn maximized(self, maximized: bool) -> Self;
fn visible(self, visible: bool) -> Self;
fn transparent(self, transparent: bool) -> Self;
fn decorations(self, decorations: bool) -> Self;
fn always_on_top(self, always_on_top: bool) -> Self;
fn icon(self, icon: Self::Icon) -> Self;
fn has_icon(&self) -> bool;
fn user_data_path(self, user_data_path: Option<PathBuf>) -> Self;
fn url(self, url: String) -> Self;
fn has_uri_scheme_protocol(&self, name: &str) -> bool;
fn register_uri_scheme_protocol<N: Into<String>, H: Fn(&str) -> Result<Vec<u8>> + Send + Sync + 'static>(
        self,
        uri_scheme: N,
        protocol: H
    ) -> Self;
fn build(self) -> Self;
}

A builder for all attributes related to a single webview.

This trait is only meant to be implemented by a custom Runtime and not by applications.

Associated Types

type Icon: TryFrom<Icon, Error = Error>[src]

Expected icon format.

Loading content...

Required methods

fn new() -> Self[src]

Initializes a new webview builder.

fn with_config(config: WindowConfig) -> Self[src]

Initializes a new webview builder from a WindowConfig

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

Sets the init script.

fn x(self, x: f64) -> Self[src]

The horizontal position of the window’s top left corner.

fn y(self, y: f64) -> Self[src]

The vertical position of the window’s top left corner.

fn width(self, width: f64) -> Self[src]

Window width.

fn height(self, height: f64) -> Self[src]

Window height.

fn min_width(self, min_width: f64) -> Self[src]

Window min width.

fn min_height(self, min_height: f64) -> Self[src]

Window min height.

fn max_width(self, max_width: f64) -> Self[src]

Window max width.

fn max_height(self, max_height: f64) -> Self[src]

Window max height.

fn resizable(self, resizable: bool) -> Self[src]

Whether the window is resizable or not.

fn title<S: Into<String>>(self, title: S) -> Self[src]

The title of the window in the title bar.

fn fullscreen(self, fullscreen: bool) -> Self[src]

Whether to start the window in fullscreen or not.

fn maximized(self, maximized: bool) -> Self[src]

Whether the window should be maximized upon creation.

fn visible(self, visible: bool) -> Self[src]

Whether the window should be immediately visible upon creation.

fn transparent(self, transparent: bool) -> Self[src]

Whether the the window should be transparent. If this is true, writing colors with alpha values different than 1.0 will produce a transparent window.

fn decorations(self, decorations: bool) -> Self[src]

Whether the window should have borders and bars.

fn always_on_top(self, always_on_top: bool) -> Self[src]

Whether the window should always be on top of other windows.

fn icon(self, icon: Self::Icon) -> Self[src]

Sets the window icon.

fn has_icon(&self) -> bool[src]

Whether the icon was set or not.

fn user_data_path(self, user_data_path: Option<PathBuf>) -> Self[src]

User data path for the webview. Actually only supported on Windows.

fn url(self, url: String) -> Self[src]

Sets the webview url.

fn has_uri_scheme_protocol(&self, name: &str) -> bool[src]

Whether the webview URI scheme protocol is defined or not.

fn register_uri_scheme_protocol<N: Into<String>, H: Fn(&str) -> Result<Vec<u8>> + 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.

fn build(self) -> Self[src]

The full attributes.

Loading content...

Implementors

impl Attributes for WryAttributes[src]

type Icon = WryIcon

Loading content...