Struct RuntimeContext

Source
pub struct RuntimeContext<T: UserEvent> { /* private fields */ }

Implementations§

Source§

impl<T: UserEvent> RuntimeContext<T>

Source

pub fn send_message(&self, message: Message<T>) -> Result<()>

Source

pub fn run_on_main_thread<F: FnOnce() + Send + 'static>( &self, f: F, ) -> Result<()>

Run a task on the main thread.

Source

pub fn run_on_main_thread_with_event_loop<X: Send + Sync + 'static, F: FnOnce(&TaoEventLoopWindowTarget<Message<T>>) -> X + Send + 'static>( &self, f: F, ) -> Result<X>

Run a task on the main thread.

Source

pub fn next_window_id(&self) -> WindowId

Source

pub fn next_webview_id(&self) -> u32

Source

pub fn next_window_event_id(&self) -> WindowEventId

Source

pub fn next_webview_event_id(&self) -> WindowEventId

Source

pub fn create_window<R: Runtime<T, WindowDispatcher = VersoWindowDispatcher<T>, WebviewDispatcher = VersoWebviewDispatcher<T>>, F: Fn(RawWindow<'_>) + Send + 'static>( &self, pending: PendingWindow<T, R>, _after_window_creation: Option<F>, ) -> Result<DetachedWindow<T, R>>

after_window_creation not supported

Only creating the window with a webview is supported, will return [tauri_runtime::Error::CreateWindow] if there is no [PendingWindow::webview]

Source

pub fn handle_close_window_request<F: FnMut(RunEvent<T>) + 'static>( &self, callback: &mut F, id: WindowId, force: bool, ) -> bool

Handles the close window request by sending the [WindowEvent::CloseRequested] event if the request doesn’t request a forced close and if not prevented, send [WindowEvent::Destroyed] then checks if there’re windows left, if not, send [RunEvent::ExitRequested] returns if we should exit the event loop

Trait Implementations§

Source§

impl<T: Clone + UserEvent> Clone for RuntimeContext<T>

Source§

fn clone(&self) -> RuntimeContext<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: UserEvent> Debug for RuntimeContext<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for RuntimeContext<T>

§

impl<T> RefUnwindSafe for RuntimeContext<T>

§

impl<T> Send for RuntimeContext<T>

§

impl<T> Sync for RuntimeContext<T>

§

impl<T> Unpin for RuntimeContext<T>
where T: Unpin,

§

impl<T> UnwindSafe for RuntimeContext<T>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> UserEvent for T
where T: Debug + Clone + Send + 'static,