Skip to main content

GpuiWindowExt

Trait GpuiWindowExt 

Source
pub trait GpuiWindowExt {
    // Required methods
    fn attach_gpui_view<F, V>(
        &self,
        options: GpuiOptions,
        root: F,
    ) -> Result<(), GpuiError>
       where F: FnOnce(&mut Window, &mut App) -> Entity<V> + 'static,
             V: Render + 'static;
    fn is_gpui_attached(&self) -> bool;

    // Provided methods
    fn attach_gpui<F, V>(&self, root: F) -> Result<(), GpuiError>
       where F: FnOnce(&mut App) -> Entity<V> + 'static,
             V: Render + 'static { ... }
    fn attach_gpui_with<F, V>(
        &self,
        options: GpuiOptions,
        root: F,
    ) -> Result<(), GpuiError>
       where F: FnOnce(&mut App) -> Entity<V> + 'static,
             V: Render + 'static { ... }
}
Expand description

Attaches GPUI as the content renderer of a Tauri window.

Required Methods§

Source

fn attach_gpui_view<F, V>( &self, options: GpuiOptions, root: F, ) -> Result<(), GpuiError>
where F: FnOnce(&mut Window, &mut App) -> Entity<V> + 'static, V: Render + 'static,

Like attach_gpui_with, but the root builder also receives the GPUI Window. Component libraries need this to wrap content in their root view, e.g. |window, cx| cx.new(|cx| Root::new(view, window, cx)).

Source

fn is_gpui_attached(&self) -> bool

Whether GPUI is attached to this window.

Provided Methods§

Source

fn attach_gpui<F, V>(&self, root: F) -> Result<(), GpuiError>
where F: FnOnce(&mut App) -> Entity<V> + 'static, V: Render + 'static,

Permanently attaches GPUI to this window and mounts root as its root view. There is no detach: the GPUI root and its rendering surface are destroyed together with the Tauri window.

Must be called on the main thread for a window without a WebView. Child webviews can be added afterwards and placed with webview_frame. When called from inside GPUI code the mount completes right after the current GPUI update returns.

Source

fn attach_gpui_with<F, V>( &self, options: GpuiOptions, root: F, ) -> Result<(), GpuiError>
where F: FnOnce(&mut App) -> Entity<V> + 'static, V: Render + 'static,

attach_gpui with explicit options.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl GpuiWindowExt for Window<Wry>

Source§

fn attach_gpui_view<F, V>( &self, options: GpuiOptions, root: F, ) -> Result<(), GpuiError>
where F: FnOnce(&mut Window, &mut App) -> Entity<V> + 'static, V: Render + 'static,

Source§

fn is_gpui_attached(&self) -> bool

Implementors§