pub struct Builder<'a> { /* private fields */ }build only.Expand description
Builder of the Tauri plugin build script.
It must be executed from the build.rs of every Tauri plugin crate - see
Self::try_build for everything it does.
§Examples
const COMMANDS: &[&str] = &["ping", "execute"];
tauri_plugin::Builder::new(COMMANDS)
.android_path("android")
.ios_path("ios")
.build();Implementations§
Source§impl<'a> Builder<'a>
impl<'a> Builder<'a>
Sourcepub fn new(commands: &'a [&'static str]) -> Self
pub fn new(commands: &'a [&'static str]) -> Self
Creates a new builder for a plugin exposing the given commands.
The command names must be written in snake_case, matching the name of the Rust functions
annotated with #[tauri::command]. An allow-$command and a deny-$command permission
is generated for each of them in the permissions/autogenerated/commands directory,
where $command is the command name with _ replaced by -.
Note that the default permission of the plugin is not autogenerated:
it must be defined in a permissions/default.toml (or .json) file.
Sourcepub fn global_scope_schema(self, schema: RootSchema) -> Self
pub fn global_scope_schema(self, schema: RootSchema) -> Self
Sets the global scope JSON schema.
Sourcepub fn global_api_script_path<P: Into<PathBuf>>(self, path: P) -> Self
pub fn global_api_script_path<P: Into<PathBuf>>(self, path: P) -> Self
Sets the path to the script that is injected in the webview when the withGlobalTauri configuration is set to true.
This is usually an IIFE that injects the plugin API JavaScript bindings to window.__TAURI__.
Sourcepub fn android_path<P: Into<PathBuf>>(self, android_path: P) -> Self
pub fn android_path<P: Into<PathBuf>>(self, android_path: P) -> Self
Sets the Android project path.
Sourcepub fn build(self)
pub fn build(self)
Self::try_build but will exit automatically if an error is found.