Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove blanket Render impl for T: Display #320

Merged
merged 6 commits into from
Nov 21, 2021

Conversation

lambda-fairy
Copy link
Owner

@lambda-fairy lambda-fairy commented Nov 18, 2021

Closes #271

How to migrate

If you have code that uses a Display impl, like so:

let ip_address = Ipv4Addr::new(127, 0, 0, 1);
html! {
    "There's no place like " (ip_address)
}

Then change it to use maud::display (#350):

let ip_address = Ipv4Addr::new(127, 0, 0, 1);
html! {
    "There's no place like " (maud::display(ip_address))
}

@lambda-fairy
Copy link
Owner Author

lambda-fairy commented Nov 18, 2021

  • Update changelog
  • Update docs
  • Add itoa optimization
  • Test miniserve

@lambda-fairy lambda-fairy marked this pull request as ready for review November 21, 2021 08:56
@lambda-fairy lambda-fairy merged commit 2f3d68c into main Nov 21, 2021
@lambda-fairy lambda-fairy deleted the remove-display-blanket-impl branch November 21, 2021 08:58
@lambda-fairy
Copy link
Owner Author

lambda-fairy commented Nov 21, 2021

miniserve needs this patch:

diff --git a/src/renderer.rs b/src/renderer.rs
index ba2c4e6..72ff602 100644
--- a/src/renderer.rs
+++ b/src/renderer.rs
@@ -423,7 +423,7 @@ fn entry_row(
                         @if !raw {
                             @if let Some(size) = entry.size {
                                 span.mobile-info.size {
-                                    (size)
+                                    (maud::display(size))
                                 }
                             }
                         }
@@ -432,7 +432,7 @@ fn entry_row(
             }
             td.size-cell {
                 @if let Some(size) = entry.size {
-                    (size)
+                    (maud::display(size))
                 }
             }
             td.date-cell {

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.

Remove blanket Render impl for T: Display
1 participant