parent
1ab01cca27
commit
b7e5768d44
3 changed files with 15 additions and 1 deletions
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
- Remove `AsRef<str>` restriction from `PreEscaped`
|
- Remove `AsRef<str>` restriction from `PreEscaped`
|
||||||
[#377](https://github.com/lambda-fairy/maud/pull/377)
|
[#377](https://github.com/lambda-fairy/maud/pull/377)
|
||||||
|
- Implement `Render` for `Arc<T>`
|
||||||
|
[#380](https://github.com/lambda-fairy/maud/pull/380)
|
||||||
|
|
||||||
## [0.25.0] - 2023-04-16
|
## [0.25.0] - 2023-04-16
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
use alloc::{borrow::Cow, boxed::Box, string::String};
|
use alloc::{borrow::Cow, boxed::Box, string::String, sync::Arc};
|
||||||
use core::fmt::{self, Arguments, Display, Write};
|
use core::fmt::{self, Arguments, Display, Write};
|
||||||
|
|
||||||
pub use maud_macros::html;
|
pub use maud_macros::html;
|
||||||
|
@ -150,6 +150,12 @@ impl<T: Render + ?Sized> Render for Box<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: Render + ?Sized> Render for Arc<T> {
|
||||||
|
fn render_to(&self, w: &mut String) {
|
||||||
|
T::render_to(self, w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! impl_render_with_display {
|
macro_rules! impl_render_with_display {
|
||||||
($($ty:ty)*) => {
|
($($ty:ty)*) => {
|
||||||
$(
|
$(
|
||||||
|
|
|
@ -137,3 +137,9 @@ fn default() {
|
||||||
assert_eq!(Markup::default().0, "");
|
assert_eq!(Markup::default().0, "");
|
||||||
assert_eq!(PreEscaped::<&'static str>::default().0, "");
|
assert_eq!(PreEscaped::<&'static str>::default().0, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_arc() {
|
||||||
|
let arc = std::sync::Arc::new("foo");
|
||||||
|
assert_eq!(html! { (arc) }.into_string(), "foo");
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue