pub trait VisualContext: AppContext {
// Required methods
fn window_handle(&self) -> AnyWindowHandle;
fn update_window_entity<T: 'static, R>(
&mut self,
entity: &Entity<T>,
update: impl FnOnce(&mut T, &mut Window, &mut Context<'_, T>) -> R,
) -> Self::Result<R>;
fn new_window_entity<T: 'static>(
&mut self,
build_entity: impl FnOnce(&mut Window, &mut Context<'_, T>) -> T,
) -> Self::Result<Entity<T>>;
fn replace_root_view<V>(
&mut self,
build_view: impl FnOnce(&mut Window, &mut Context<'_, V>) -> V,
) -> Self::Result<Entity<V>>
where V: 'static + Render;
fn focus<V>(&mut self, entity: &Entity<V>) -> Self::Result<()>
where V: Focusable;
}Expand description
This trait is used for the different visual contexts in GPUI that require a window to be present.
Required Methods§
Sourcefn window_handle(&self) -> AnyWindowHandle
fn window_handle(&self) -> AnyWindowHandle
Returns the handle of the window associated with this context.
Sourcefn update_window_entity<T: 'static, R>(
&mut self,
entity: &Entity<T>,
update: impl FnOnce(&mut T, &mut Window, &mut Context<'_, T>) -> R,
) -> Self::Result<R>
fn update_window_entity<T: 'static, R>( &mut self, entity: &Entity<T>, update: impl FnOnce(&mut T, &mut Window, &mut Context<'_, T>) -> R, ) -> Self::Result<R>
Update a view with the given callback
Sourcefn new_window_entity<T: 'static>(
&mut self,
build_entity: impl FnOnce(&mut Window, &mut Context<'_, T>) -> T,
) -> Self::Result<Entity<T>>
fn new_window_entity<T: 'static>( &mut self, build_entity: impl FnOnce(&mut Window, &mut Context<'_, T>) -> T, ) -> Self::Result<Entity<T>>
Create a new entity, with access to Window.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.