Struct tauri_build::CodegenContext
source · [−]pub struct CodegenContext { /* private fields */ }
codegen
only.Expand description
A builder for generating a Tauri application context during compile time.
Implementations
sourceimpl CodegenContext
impl CodegenContext
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new CodegenContext
builder that is already filled with the default options.
sourcepub fn config_path(self, config_path: impl Into<PathBuf>) -> Self
pub fn config_path(self, config_path: impl Into<PathBuf>) -> Self
Set the path to the tauri.conf.json
(relative to the package’s directory).
This defaults to a file called tauri.conf.json
inside of the current working directory of
the package compiling; does not need to be set manually if that config file is in the same
directory as your Cargo.toml
.
sourcepub fn out_file(self, filename: PathBuf) -> Self
pub fn out_file(self, filename: PathBuf) -> Self
Sets the output file’s path.
Note: This path should be relative to the OUT_DIR
.
Don’t set this if you are using tauri::include_codegen_context!
as that helper macro
expects the default value. This option can be useful if you are not using the helper and
instead using std::include!
on the generated code yourself.
Defaults to tauri-build-context.rs
.
sourcepub fn dev(self) -> Self
pub fn dev(self) -> Self
Run the codegen in a dev
context, meaning that Tauri is using a dev server or local file for development purposes,
usually with the tauri dev
CLI command.
sourcepub fn build(self) -> PathBuf
pub fn build(self) -> PathBuf
Generate the code and write it to the output file - returning the path it was saved to.
Unless you are doing something special with this builder, you don’t need to do anything with the returned output path.
Panics
If any parts of the codegen fail, this will panic with the related error message. This is
typically desirable when running inside a build script; see Self::try_build
for no panics.
sourcepub fn try_build(self) -> Result<PathBuf>
pub fn try_build(self) -> Result<PathBuf>
Non-panicking Self::build
Trait Implementations
sourceimpl Debug for CodegenContext
impl Debug for CodegenContext
Auto Trait Implementations
impl RefUnwindSafe for CodegenContext
impl Send for CodegenContext
impl Sync for CodegenContext
impl Unpin for CodegenContext
impl UnwindSafe for CodegenContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more