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

@@ -1,4 +1,4 @@
use crate::layout::{Painter, TextData, Textures, Ui, Vec2, WidgetId, WidgetIdFnRet, Widgets};
use crate::layout::{Painter, TextData, Textures, Ui, Vec2, WidgetId, WidgetIdFn, Widgets};
use std::{any::Any, marker::PhantomData};
@@ -31,7 +31,7 @@ pub trait WidgetLike<Tag> {
fn with_id<W2>(
self,
f: impl FnOnce(&mut Ui, WidgetId<Self::Widget>) -> WidgetId<W2>,
) -> WidgetIdFnRet!(W2)
) -> WidgetIdFn!(W2)
where
Self: Sized,
{
@@ -48,12 +48,12 @@ pub trait WidgetLike<Tag> {
/// Useful for defining trait functions on widgets that create a parent widget so that the children
/// don't need to be IDs yet
/// currently a macro for rust analyzer (doesn't support trait aliases atm)
macro_rules! WidgetFnRet {
macro_rules! WidgetFn {
($W:ty) => {
impl FnOnce(&mut $crate::layout::Ui) -> $W
};
}
pub(crate) use WidgetFnRet;
pub(crate) use WidgetFn;
impl<W: Widget, F: FnOnce(&mut Ui) -> W> WidgetLike<FnTag> for F {
type Widget = W;