From 54a2046edc6386ade790c107815c9b9a15512fb4 Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Fri, 15 Jan 2021 22:38:47 +0100 Subject: Add no_std support to askama_escape --- askama_escape/src/lib.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'askama_escape/src/lib.rs') 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 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(), ""); -- cgit