[−][src]Function htmlentity::entity::encode_with
pub fn encode_with<F>(content: &str, encoder: F) -> String where
F: Fn(char) -> Option<EncodeType>,
encode with the Encoder function.
Examples
use htmlentity::entity::*; let html = "<div class='header'></div>"; let html_encoded = encode_with(html, |ch:char|{ if(EntitySet::SpecialChars.contains(&ch)){ return Some(EncodeType::Named); } None }); assert_eq!(html_encoded, "<div class='header'></div>"); let html_decoded = decode(&html_encoded);