Skip to content

Add enum support to #[derive(ViewChild)] - #111

Merged
schell merged 1 commit into
mainfrom
feat/viewchild-enum
Aug 24, 2026
Merged

schell merged 1 commit into
mainfrom
feat/viewchild-enum

Conversation

@schell

@schell schell commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Extends the ViewChild derive macro to enums.

  • Single-field tuple variants (A(T)) auto-proxy to the inner value
  • Struct variants and multi-field tuple variants require exactly one #[child]-annotated field (consistent with structs)
  • Unit variants produce a compile error pointing toward single-field tuple variants
  • Generated impl overrides as_append_arg with a match whose arms each return a boxed iterator so arm iterator types unify

Adds enum examples to the rsx and an_introduction module docs and four SSR-based tests covering the new variant shapes. All tests and doctests pass; clippy clean.

Single-field tuple variants auto-proxy to their inner value. Struct
variants and multi-field tuple variants require a #[child]-annotated
field, matching the existing struct behavior. Unit variants produce a
compile error pointing users toward single-field tuple variants. The
generated impl overrides as_append_arg with a match whose arms each
return a boxed iterator so arm types unify.

Also adds enum examples to the rsx and an_introduction module docs and
four SSR-based tests covering the new variant shapes.
@schell
schell merged commit 1cad244 into main Aug 24, 2026
1 check passed
@schell
schell deleted the feat/viewchild-enum branch August 24, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant