#[macro_export]
macro_rules! actions {
($namespace:path, [ $( $(#[$attr:meta])* $name:ident),* $(,)? ]) => {
$(
#[derive(
::std::clone::Clone,
::std::cmp::PartialEq,
::std::default::Default,
::std::fmt::Debug,
$crate::Action
)]
#[action(namespace = $namespace)]
$(#[$attr])*
pub struct $name;
)*
};
([ $( $(#[$attr:meta])* $name:ident),* $(,)? ]) => {
$(
#[derive(
::std::clone::Clone,
::std::cmp::PartialEq,
::std::default::Default,
::std::fmt::Debug,
$crate::Action
)]
$(#[$attr])*
pub struct $name;
)*
};
}
// Same-package derives need a stable library name, including example targets.
extern crate self as wgpui_kit;
pub use ::wgpui::*;
#[doc(hidden)]
pub use crate as gpui;
#[doc(hidden)]
pub const GPUI_FAST: bool = false;
#[cfg(feature = "test-support")]
pub mod test;
pub use ::wgpui_base as base;
pub use ::wgpui_platform as platform;
pub use wgpui_base::is_mobile;
#[cfg(feature = "component")]
pub use ::wgpui_component as component;
#[cfg(feature = "assets")]
pub use ::wgpui_kit_assets as assets;
pub use ::wgpui_platform::application;
pub fn open_window<V: Render>(
options: WindowOptions,
cx: &mut App,
build: impl FnOnce(&mut Window, &mut App) -> Entity<V>,
) -> Result<(AnyWindowHandle, Entity<V>)> {
let mut built = None;
let window = cx.open_window(options, |window, cx| {
let view = build(window, cx);
built = Some(view.clone());
cx.new(|cx| base::Root::new(view, window, cx))
})?;
let content = built
.ok_or_else(|| private::anyhow::Error::msg("window did not build application content"))?;
Ok((window.into(), content))
}
pub fn init(cx: &mut App) {
#[cfg(feature = "component")]
wgpui_component::init(cx);
#[cfg(not(feature = "component"))]
wgpui_base::init(cx);
}
pub use wgpui_base::TestSupportExt;