Skip to main content

Builder

Struct Builder 

Source
pub struct Builder { /* private fields */ }
Expand description

Configures the plugin.

Implementations§

Source§

impl Builder

Source

pub fn new() -> Self

Creates a builder with the default configuration.

Source

pub fn host(self, host: impl Into<IpAddr>) -> Self

Sets the address the server binds to.

Only change this if you need to reach the app from another device; the server has no authentication, so anything that can connect can run your commands.

Overridden by the DEV_INVOKE_HOST environment variable.

Source

pub fn port(self, port: u16) -> Self

Sets the port the server binds to. Defaults to DEFAULT_PORT.

Overridden by the DEV_INVOKE_PORT environment variable, which is how you give each of several dev instances its own listener without rebuilding.

Source

pub fn window(self, label: impl Into<String>) -> Self

Routes browser requests through the webview with this label.

Browser clients impersonate a single webview: commands taking a tauri::Window or tauri::Webview receive it, and its capabilities decide what is allowed.

Source

pub fn allow_origin(self, origin: impl Into<String>) -> Self

Allows an additional browser origin, e.g. http://localhost:5173.

Source

pub fn allowed_origins<I, S>(self, origins: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Replaces the origin allowlist with exactly these origins.

Overridden by the DEV_INVOKE_ALLOWED_ORIGINS environment variable, a comma-separated list (or * for any origin). Origins added with Builder::allow_origin still apply on top of whichever list wins.

Source

pub fn allow_any_origin(self) -> Self

Accepts requests from any origin.

Every page you visit while the app runs can then invoke your app’s commands. Prefer Builder::allow_origin.

Source

pub fn serve_assets(self, enabled: bool) -> Self

Serves files for convertFileSrc() over HTTP. Enabled by default.

The endpoint reads arbitrary paths off disk, which is what the asset: protocol does inside the webview. Disable it if you would rather not expose that on loopback.

Source

pub fn timeout(self, timeout: Duration) -> Self

Sets how long a single command may run before the request fails. Defaults to 10 minutes.

Source

pub fn enabled_in_release(self, enabled: bool) -> Self

Runs the server in release builds too.

This has no effect unless the allow-in-release cargo feature is enabled; without it the server is not compiled into release builds at all.

Source

pub fn build<R: Runtime>(self) -> TauriPlugin<R>

Builds the plugin.

Trait Implementations§

Source§

impl Clone for Builder

Source§

fn clone(&self) -> Builder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Builder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Builder

Source§

fn default() -> Builder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> UserEvent for T
where T: Debug + Clone + Send + 'static,