//! Minimal stand-in for the real `gpui` crate. The lints key off the crate //! name and the type names, so we only need to reproduce the relevant API //! surface. use std::marker::PhantomData; // --- AppContext --- pub trait AppContext { fn as_app_mut(&mut self) -> &mut App; } // --- App --- pub struct App; impl AppContext for App { fn as_app_mut(&mut self) -> &mut App { self } } // --- Context --- pub struct Context<'a, T> { _marker: PhantomData<&'a mut T>, } impl AppContext for Context<'_, T> { fn as_app_mut(&mut self) -> &mut App { unimplemented!() } } impl Context<'_, T> { pub fn notify(&mut self) {} } // --- Window --- pub struct Window; // --- Entity --- pub struct Entity { _marker: PhantomData, } impl Entity { pub fn update( &self, _cx: &mut C, _f: impl FnOnce(&mut T, &mut Context) -> R, ) -> R { unimplemented!() } pub fn read<'a>(&self, _cx: &'a App) -> &'a T { unimplemented!() } pub fn read_with(&self, _cx: &App, _f: impl FnOnce(&T, &App) -> R) -> R { unimplemented!() } pub fn downgrade(&self) -> WeakEntity { unimplemented!() } } // --- WeakEntity --- pub struct WeakEntity { _marker: PhantomData, } impl WeakEntity { pub fn update( &self, _cx: &mut C, _f: impl FnOnce(&mut T, &mut Context) -> R, ) -> Result { unimplemented!() } } // --- Render traits --- pub trait IntoElement {} pub trait Render: 'static + Sized { fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement; } pub trait RenderOnce: 'static { fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement; } impl IntoElement for () {} impl IntoElement for &str {}