Skip to main content

Attributes

Struct Attributes 

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

The attributes used on the build.

Implementations§

Source§

impl Attributes

Source

pub fn new() -> Self

Creates the default attribute set.

Source

pub fn windows_attributes(self, windows_attributes: WindowsAttributes) -> Self

Sets the WindowsAttributes, the Windows-specific options of the build script.

They are used to configure the application manifest, the application icon, additional .rc content and the static linking of the Visual C++ runtime. Setting them has no effect when compiling for other platforms.

§Examples
let attributes = tauri_build::Attributes::new().windows_attributes(
  tauri_build::WindowsAttributes::new()
    .window_icon_path("icons/icon.ico")
    .static_vc_runtime(true),
);
tauri_build::try_build(attributes).expect("failed to run tauri-build");
Source

pub fn capabilities_path_pattern(self, pattern: &'static str) -> Self

Set the glob pattern to be used to find the capabilities.

WARNING: The removeUnusedCommands option does not work with a custom capabilities path.

Note: You must emit rerun-if-changed instructions for your capabilities directory.

Source

pub fn plugin(self, name: &'static str, plugin: InlinedPlugin) -> Self

Adds the given plugin to the list of inlined plugins (a plugin that is part of your application).

See InlinedPlugin for more information.

Source

pub fn plugins<I>(self, plugins: I) -> Self
where I: IntoIterator<Item = (&'static str, InlinedPlugin)>,

Adds the given list of plugins to the list of inlined plugins (a plugin that is part of your application).

See InlinedPlugin for more information.

Source

pub fn config_path(self, config_path: impl Into<PathBuf>) -> Self

Set the path to the tauri.conf.json (relative to the crate’s directory).

This defaults to a file called tauri.conf.json inside of the current working directory of the crate compiling; does not need to be set manually if that config file is in the same directory as your Cargo.toml.

Source

pub fn app_manifest(self, manifest: AppManifest) -> Self

Sets the application manifest for the Access Control List.

See AppManifest for more information.

Source

pub fn codegen(self, codegen: CodegenContext) -> Self

Available on crate feature codegen only.

Generates the Tauri application context at build time instead of at macro expansion time.

The context is written to a file in the OUT_DIR that the tauri::tauri_build_context! macro includes, so the application uses tauri::Builder::run(tauri::tauri_build_context!()) instead of tauri::Builder::run(tauri::generate_context!()).

This moves the asset embedding and the ACL resolution to the build script, which means the cargo:rerun-if-changed instructions emitted for the frontend assets, icons and configuration files are respected - with generate_context! the code is only regenerated when the crate itself is recompiled.

See CodegenContext for the available options.

Requires the codegen Cargo feature.

§Examples
let attributes = tauri_build::Attributes::new().codegen(tauri_build::CodegenContext::new());
tauri_build::try_build(attributes).expect("failed to run tauri-build");

Trait Implementations§

Source§

impl Debug for Attributes

Source§

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

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

impl Default for Attributes

Source§

fn default() -> Self

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.