Skip to main content

BootBuilder

Struct BootBuilder 

Source
pub struct BootBuilder<R: Runtime> { /* private fields */ }
Expand description

Builder for creating a Tauri plugin with an optional async boot phase.

§Example

allframe_tauri::builder(router)
    .on_boot(2, |ctx| async move {
        // async initialization...
        Ok(())
    })
    .build()

Implementations§

Source§

impl<R: Runtime> BootBuilder<R>

Source

pub fn has_boot(&self) -> bool

Returns true if an async boot closure has been registered.

Source

pub fn step_count(&self) -> u32

Returns the number of progress steps declared via on_boot.

Source§

impl<R: Runtime> BootBuilder<R>

Source

pub fn new(router: Router) -> Self

Create a new boot builder with the given router.

Source

pub fn on_boot<F, Fut>(self, steps: u32, f: F) -> Self
where F: FnOnce(BootContext<R>) -> Fut + Send + 'static, Fut: Future<Output = Result<(), BootError>> + Send + 'static,

Set the async boot closure.

steps is the total number of progress steps (for the denominator in BootProgress). The closure receives a BootContext for state injection and progress reporting.

The boot closure runs on a dedicated current-thread Tokio runtime inside Tauri’s synchronous setup() hook. It blocks until completion, ensuring all state is ready before the UI renders.

Source

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

Build the Tauri plugin.

If on_boot was called, a current-thread Tokio runtime is created inside setup() to drive the async boot to completion before the app renders.

Auto Trait Implementations§

§

impl<R> Freeze for BootBuilder<R>

§

impl<R> !RefUnwindSafe for BootBuilder<R>

§

impl<R> Send for BootBuilder<R>

§

impl<R> !Sync for BootBuilder<R>

§

impl<R> Unpin for BootBuilder<R>

§

impl<R> UnsafeUnpin for BootBuilder<R>

§

impl<R> !UnwindSafe for BootBuilder<R>

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, 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.