CodegenContext

Struct CodegenContext 

Source
pub struct CodegenContext { /* private fields */ }
Available on crate feature codegen only.
Expand description

A builder for generating a Tauri application context during compile time.

Implementations§

Source§

impl CodegenContext

Source

pub fn new() -> Self

Create a new CodegenContext builder that is already filled with the default options.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn try_build(self) -> Result<PathBuf>

Non-panicking Self::build

Trait Implementations§

Source§

impl Debug for CodegenContext

Source§

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

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

impl Default for CodegenContext

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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> ErasedDestructor for T
where T: 'static,