Skip to main content

BootContext

Struct BootContext 

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

Context passed to the async boot closure.

Provides access to the Tauri AppHandle, state injection into the Router’s shared state map, and progress event emission.

Implementations§

Source§

impl<R: Runtime> BootContext<R>

Source

pub fn app_handle(&self) -> &AppHandle<R>

Access the Tauri AppHandle.

Source

pub fn data_dir(&self) -> Result<PathBuf, BootError>

Convenience: resolve the app data directory.

Source

pub fn inject_state<S: Send + Sync + 'static>(&self, state: S)

Inject state into the Router so handlers can access it via State<Arc<S>>.

State is immediately visible to handlers at call time because the Router resolves state lazily from the shared map.

Source

pub fn emit_progress(&self, label: &str)

Emit a progress event to the frontend.

Increments the internal step counter and emits an allframe-tauri:boot-progress event with the step number, total, and label.

Auto Trait Implementations§

§

impl<R> !Freeze for BootContext<R>

§

impl<R> !RefUnwindSafe for BootContext<R>

§

impl<R> Send for BootContext<R>

§

impl<R> Sync for BootContext<R>

§

impl<R> Unpin for BootContext<R>

§

impl<R> UnsafeUnpin for BootContext<R>

§

impl<R> !UnwindSafe for BootContext<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.