From 7d9cd43c0eff93e500cdfdb2adb5d00342d42a1e Mon Sep 17 00:00:00 2001 From: Geoffrey Garrett Date: Fri, 10 Jan 2025 19:54:01 +0200 Subject: [PATCH] feat: impl AddAnyAttr trait for Static (#3464) * Implement AddAnyAttr trait for Static Closes #3463 * [autofix.ci] apply automated fixes --------- Co-authored-by: geoffreygarrett Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- tachys/src/view/static_types.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tachys/src/view/static_types.rs b/tachys/src/view/static_types.rs index d7244b7b60..234b3409a0 100644 --- a/tachys/src/view/static_types.rs +++ b/tachys/src/view/static_types.rs @@ -220,7 +220,7 @@ impl RenderHtml for Static { } impl AddAnyAttr for Static { - type Output = Static; + type Output = Static; fn add_any_attr( self, @@ -229,7 +229,15 @@ impl AddAnyAttr for Static { where Self::Output: RenderHtml, { - todo!() + // inline helper function to assist the compiler with type inference + #[inline(always)] + const fn create_static( + ) -> as AddAnyAttr>::Output { + Static + } + + // call the helper function with the current const value and new attribute type + create_static::() } }