aboutsummaryrefslogtreecommitdiffstats
path: root/askama_escape/src
diff options
context:
space:
mode:
authorLibravatar Wim Looman <git@nemo157.com>2021-01-15 22:38:47 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2021-01-15 23:35:33 +0100
commit54a2046edc6386ade790c107815c9b9a15512fb4 (patch)
treeb25b457fc139758ae89f1fa0ab29e2789e722007 /askama_escape/src
parent000aff4a18c90a5074afd1af5587ff94e915e7d1 (diff)
downloadaskama-54a2046edc6386ade790c107815c9b9a15512fb4.tar.gz
askama-54a2046edc6386ade790c107815c9b9a15512fb4.tar.bz2
askama-54a2046edc6386ade790c107815c9b9a15512fb4.zip
Add no_std support to askama_escape
Diffstat (limited to 'askama_escape/src')
-rw-r--r--askama_escape/src/lib.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/askama_escape/src/lib.rs b/askama_escape/src/lib.rs
index 0222277..fcc36c6 100644
--- a/askama_escape/src/lib.rs
+++ b/askama_escape/src/lib.rs
@@ -1,5 +1,10 @@
-use std::fmt::{self, Display, Formatter, Write};
-use std::str;
+#![no_std]
+
+#[cfg(test)]
+extern crate std;
+
+use core::fmt::{self, Display, Formatter, Write};
+use core::str;
pub struct MarkupDisplay<E, T>
where
@@ -88,7 +93,7 @@ where
escaper: E,
}
-impl<'a, E> ::std::fmt::Display for Escaped<'a, E>
+impl<'a, E> Display for Escaped<'a, E>
where
E: Escaper,
{
@@ -168,6 +173,8 @@ const FLAG: u8 = b'>' - b'"';
#[cfg(test)]
mod tests {
use super::*;
+ use std::string::ToString;
+
#[test]
fn test_escape() {
assert_eq!(escape("", Html).to_string(), "");