pub fn fill_measure<B: day_spec::Toolkit>(
_backend: &mut B,
_handle: &B::Handle,
proposal: day_spec::Proposal,
) -> day_spec::Size {
day_spec::Size::new(
proposal.width.unwrap_or(0.0),
proposal.height.unwrap_or(0.0),
)
}
#[macro_export]
macro_rules! renderer {
($slice:path, $backend:ty, kind: $kind:expr, props: $props:ty, patch: $patch:ty,
make: $make:expr, update: $update:expr, measure: $measure:expr, release: $release:expr $(,)?) => {
$crate::__renderer!(
$slice,
$backend,
$kind,
$props,
$patch,
$make,
$update,
::core::option::Option::Some($measure),
::core::option::Option::Some($release)
);
};
($slice:path, $backend:ty, kind: $kind:expr, props: $props:ty, patch: $patch:ty,
make: $make:expr, update: $update:expr, measure: $measure:expr $(,)?) => {
$crate::__renderer!(
$slice,
$backend,
$kind,
$props,
$patch,
$make,
$update,
::core::option::Option::Some($measure),
::core::option::Option::None
);
};
($slice:path, $backend:ty, kind: $kind:expr, props: $props:ty, patch: $patch:ty,
make: $make:expr, update: $update:expr $(,)?) => {
$crate::__renderer!(
$slice,
$backend,
$kind,
$props,
$patch,
$make,
$update,
::core::option::Option::None,
::core::option::Option::None
);
};
($slice:path, $backend:ty, kind: $kind:expr, props: $props:ty,
make: $make:expr, measure: $measure:expr $(,)?) => {
$crate::__renderer!(
$slice,
$backend,
$kind,
$props,
(),
$make,
(|_b, _h, _p| {}),
::core::option::Option::Some($measure),
::core::option::Option::None
);
};
($slice:path, $backend:ty, kind: $kind:expr, props: $props:ty, make: $make:expr $(,)?) => {
$crate::__renderer!(
$slice,
$backend,
$kind,
$props,
(),
$make,
(|_b, _h, _p| {}),
::core::option::Option::None,
::core::option::Option::None
);
};
}
#[macro_export]
macro_rules! dom_renderer {
($register:path, $backend:ty, kind: $kind:expr, props: $props:ty, patch: $patch:ty,
make: $make:expr, update: $update:expr, measure: $measure:expr, release: $release:expr $(,)?) => {
$crate::__dom_renderer!(
$register,
$backend,
$kind,
$props,
$patch,
$make,
$update,
::core::option::Option::Some($measure),
::core::option::Option::Some($release)
);
};
($register:path, $backend:ty, kind: $kind:expr, props: $props:ty, patch: $patch:ty,
make: $make:expr, update: $update:expr, measure: $measure:expr $(,)?) => {
$crate::__dom_renderer!(
$register,
$backend,
$kind,
$props,
$patch,
$make,
$update,
::core::option::Option::Some($measure),
::core::option::Option::None
);
};
($register:path, $backend:ty, kind: $kind:expr, props: $props:ty, patch: $patch:ty,
make: $make:expr, update: $update:expr $(,)?) => {
$crate::__dom_renderer!(
$register,
$backend,
$kind,
$props,
$patch,
$make,
$update,
::core::option::Option::None,
::core::option::Option::None
);
};
($register:path, $backend:ty, kind: $kind:expr, props: $props:ty,
make: $make:expr, measure: $measure:expr $(,)?) => {
$crate::__dom_renderer!(
$register,
$backend,
$kind,
$props,
(),
$make,
(|_b, _h, _p| {}),
::core::option::Option::Some($measure),
::core::option::Option::None
);
};
($register:path, $backend:ty, kind: $kind:expr, props: $props:ty, make: $make:expr $(,)?) => {
$crate::__dom_renderer!(
$register,
$backend,
$kind,
$props,
(),
$make,
(|_b, _h, _p| {}),
::core::option::Option::None,
::core::option::Option::None
);
};
}
#[macro_export]
#[doc(hidden)]
macro_rules! __dom_renderer {
($register:path, $backend:ty, $kind:expr, $props:ty, $patch:ty, $make:expr, $update:expr,
$measure:expr, $release:expr) => {
pub(crate) fn register() {
($register)(|| $crate::Renderer::<$backend> {
kind: $kind,
make: |__b, __props, __id| {
let __p = __props
.downcast_ref::<$props>()
.expect(concat!("day renderer: props are not ", stringify!($props)));
($make)(__b, __p, __id)
},
update: |__b, __h, __patch| {
if let ::core::option::Option::Some(__p) = __patch.downcast_ref::<$patch>() {
($update)(__b, __h, __p)
}
},
measure: $measure,
release: $release,
});
}
};
}
#[macro_export]
#[doc(hidden)]
macro_rules! __renderer {
($slice:path, $backend:ty, $kind:expr, $props:ty, $patch:ty, $make:expr, $update:expr,
$measure:expr, $release:expr) => {
#[$crate::linkme::distributed_slice($slice)]
static __DAY_RENDERER: fn() -> $crate::Renderer<$backend> = || $crate::Renderer {
kind: $kind,
make: |__b, __props, __id| {
let __p = __props
.downcast_ref::<$props>()
.expect(concat!("day renderer: props are not ", stringify!($props)));
($make)(__b, __p, __id)
},
update: |__b, __h, __patch| {
if let ::core::option::Option::Some(__p) = __patch.downcast_ref::<$patch>() {
($update)(__b, __h, __p)
}
},
measure: $measure,
release: $release,
};
};
}
#[macro_export]
macro_rules! glue_modules {
($($tk:ident),+ $(,)?) => { $($crate::__glue_module!($tk);)+ };
}
#[doc(hidden)]
#[macro_export]
macro_rules! __glue_module {
(appkit) => {
#[cfg(all(feature = "appkit", target_os = "macos"))]
#[path = "lib-appkit.rs"]
mod appkit_impl;
};
(gtk) => {
#[cfg(feature = "gtk")]
#[path = "lib-gtk.rs"]
mod gtk_impl;
};
(qt) => {
#[cfg(feature = "qt")]
#[path = "lib-qt.rs"]
mod qt_impl;
};
(uikit) => {
#[cfg(all(feature = "uikit", target_os = "ios"))]
#[path = "lib-uikit.rs"]
mod uikit_impl;
};
(material) => {
#[cfg(all(feature = "material", target_os = "android"))]
#[path = "lib-android.rs"]
mod android_impl;
};
(xaml) => {
#[cfg(all(feature = "xaml", windows))]
#[path = "lib-xaml.rs"]
mod xaml_impl;
};
(arkui) => {
#[cfg(all(feature = "arkui", target_env = "ohos"))]
#[path = "lib-arkui.rs"]
mod arkui_impl;
};
(dom) => {
#[cfg(all(feature = "dom", target_arch = "wasm32"))]
#[path = "lib-dom.rs"]
pub(crate) mod dom_impl;
};
}