-
Notifications
You must be signed in to change notification settings - Fork 153
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
impl Render<T: Render> for Option<T> #446
Comments
Ill attempt to fix this, want to contribute since this is a really cool lib. |
impl<T: Render + ?Sized> Render for Option<T> {
fn render_to(&self, w: &mut String) { if let Some(inner) = self { T::render_to(inner, w); } }
}
impl <T: Render + ?Sized, I: ExactSizeIterator + ?Sized> Render for I where I::Item: AsRef<T> {
fn render_to(&self, w: &mut String) {
for item in self {
item.as_ref().render_to(w);
}
}
} Implemented Render for 2 types:
If there are any suggestions for other types to implement or if my implementation has issues ill gladly fix them. |
This was referenced Oct 10, 2024
This would be nice, it’s similar to how both |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for a nice library!
I ran into a case where I want to conditionally insert some markup, the condition being on an
Option
. Ended up writingbut it would have been cool if
worked, and behaved identically.
The text was updated successfully, but these errors were encountered: