rename widget fn macros

This commit is contained in:
2025-08-29 00:11:41 -04:00
parent 42f5a8d01b
commit d4690401eb
6 changed files with 32 additions and 34 deletions

View File

@@ -120,7 +120,7 @@ pub struct IdTag;
pub struct IdFnTag;
// pub trait WidgetIdFn<W, Ctx> = FnOnce(&mut Ui) -> WidgetId<W>;
macro_rules! WidgetIdFnRet {
macro_rules! WidgetIdFn {
($W:ty) => {
impl FnOnce(&mut $crate::layout::Ui) -> $crate::layout::WidgetId<$W>
};
@@ -128,15 +128,12 @@ macro_rules! WidgetIdFnRet {
impl FnOnce(&mut $crate::layout::Ui) -> $crate::layout::WidgetId<$W> + use<$($use)*>
};
}
pub(crate) use WidgetIdFnRet;
pub(crate) use WidgetIdFn;
pub trait Idable<Tag> {
type Widget: Widget;
fn set(self, ui: &mut Ui, id: &WidgetId<Self::Widget>);
fn id<'a>(
self,
id: &WidgetId<Self::Widget>,
) -> WidgetIdFnRet!(Self::Widget, 'a, Self, Tag)
fn id<'a>(self, id: &WidgetId<Self::Widget>) -> WidgetIdFn!(Self::Widget, 'a, Self, Tag)
where
Self: Sized,
{
@@ -149,7 +146,7 @@ pub trait Idable<Tag> {
fn id_static<'a>(
self,
id: StaticWidgetId<Self::Widget>,
) -> WidgetIdFnRet!(Self::Widget, 'a, Self, Tag)
) -> WidgetIdFn!(Self::Widget, 'a, Self, Tag)
where
Self: Sized,
{