You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Extractor API: which style do you prefer?
We're evaluating two approaches for injecting compile-time context (ident, fields, generics, etc.) into
#[zyn::element]functions.Option A: Attribute annotation (
#[zyn(input)])An explicit attribute marks which parameters are extracted from the macro input:
#[zyn(input)]clearly marks extracted paramsFromInputtype works directly (no wrapper needed)axum,actixOption B: Type-based detection (
Extract<T>)The
Extract<T>wrapper type itself signals that a parameter is extracted from input — no attribute needed:Extract<T>implementsDeref<Target = T>for ergonomic access"Extract")Side-by-side: derive element with multiple extractors
Option A:
Option B:
Key differences
#[zyn(input)])Extract<T>)#[zyn(input)] x: Tx: Extract<T>x.method())x.method())Tdirectly.inner()to unwrapFeel free to comment with additional thoughts!
2 votes ·
Beta Was this translation helpful? Give feedback.
All reactions