impl Default for PreEscaped ()

* impl Default for PreEscaped

* Simplify assertion

* Update CHANGELOG.md

---------

Co-authored-by: Chris Wong <lambda.fairy@gmail.com>
This commit is contained in:
Imbolc 2023-04-16 11:27:45 +06:00 committed by GitHub
parent 0d1bc320d3
commit 34b3bc00ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View file

@ -6,6 +6,8 @@
[#357](https://github.com/lambda-fairy/maud/pull/357) [#357](https://github.com/lambda-fairy/maud/pull/357)
- Support `axum` v0.6 through `axum-core` v0.3 - Support `axum` v0.6 through `axum-core` v0.3
[#361](https://github.com/lambda-fairy/maud/pull/361) [#361](https://github.com/lambda-fairy/maud/pull/361)
- Implement `Default` for `PreEscaped`
[#371](https://github.com/lambda-fairy/maud/pull/371)
## [0.24.0] - 2022-08-12 ## [0.24.0] - 2022-08-12

View file

@ -241,6 +241,12 @@ impl<T: AsRef<str> + Into<String>> From<PreEscaped<T>> for String {
} }
} }
impl<T: AsRef<str> + Default> Default for PreEscaped<T> {
fn default() -> Self {
Self(Default::default())
}
}
/// The literal string `<!DOCTYPE html>`. /// The literal string `<!DOCTYPE html>`.
/// ///
/// # Example /// # Example

View file

@ -130,3 +130,10 @@ fn prefer_render_over_display() {
"&lt;display&gt;" "&lt;display&gt;"
); );
} }
#[test]
fn default() {
use maud::{Markup, PreEscaped};
assert_eq!(Markup::default().0, "");
assert_eq!(PreEscaped::<&'static str>::default().0, "");
}