Skip to content

Commit

Permalink
chore: add Cow Renderable impl
Browse files Browse the repository at this point in the history
  • Loading branch information
vidhanio committed Jan 12, 2024
1 parent 724c522 commit c561018
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hypertext/src/alloc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate alloc;

use alloc::string::String;
use alloc::{borrow::Cow, string::String};
use core::fmt::{self, Display, Write};

/// Generate HTML using [`maud`] syntax.
Expand Down Expand Up @@ -310,6 +310,13 @@ impl Renderable for String {
}
}

impl Renderable for Cow<'_, str> {
#[inline]
fn render_to(self, output: &mut String) {
html_escape::encode_single_quoted_attribute_to_string(self, output);
}
}

impl Renderable for bool {
#[inline]
fn render_to(self, output: &mut String) {
Expand Down

0 comments on commit c561018

Please sign in to comment.