separate state from rsc

This commit is contained in:
iris committed 2026-01-01 22:18:08 -05:00
1 parent 462c0e6416
commit 5da1e9e767
22 files changed
+373 -492

No files matched your search

+4 -4
View File
@@ -159,15 +159,15 @@ pub struct SpanBuilder<State, const LEN: usize, Wa: WidgetArrLike<State, LEN, Ta
_pd: PhantomData<(State, Tag)>,
}
impl<State: StateLike<State>, const LEN: usize, Wa: WidgetArrLike<State, LEN, Tag>, Tag>
WidgetFnTrait<State> for SpanBuilder<State, LEN, Wa, Tag>
impl<Rsc, const LEN: usize, Wa: WidgetArrLike<Rsc, LEN, Tag>, Tag> WidgetFnTrait<Rsc>
for SpanBuilder<Rsc, LEN, Wa, Tag>
{
type Widget = Span;
#[track_caller]
fn run(self, state: &mut State) -> Self::Widget {
fn run(self, rsc: &mut Rsc) -> Self::Widget {
Span {
children: self.children.add(state).arr.into_iter().collect(),
children: self.children.add(rsc).arr.into_iter().collect(),
dir: self.dir,
gap: self.gap,
}
+6 -5
View File
@@ -48,14 +48,15 @@ pub struct StackBuilder<State, const LEN: usize, Wa: WidgetArrLike<State, LEN, T
_pd: PhantomData<(State, Tag)>,
}
impl<State: StateLike<State>, const LEN: usize, Wa: WidgetArrLike<State, LEN, Tag>, Tag> FnOnce<(&mut State,)>
for StackBuilder<State, LEN, Wa, Tag>
impl<Rsc, const LEN: usize, Wa: WidgetArrLike<Rsc, LEN, Tag>, Tag> WidgetFnTrait<Rsc>
for StackBuilder<Rsc, LEN, Wa, Tag>
{
type Output = Stack;
type Widget = Stack;
extern "rust-call" fn call_once(self, args: (&mut State,)) -> Self::Output {
#[track_caller]
fn run(self, rsc: &mut Rsc) -> Self::Widget {
Stack {
children: self.children.add(args.0).arr.into_iter().collect(),
children: self.children.add(rsc).arr.into_iter().collect(),
size: self.size,
}
}