safehtml 0.2.0

A high-performance, no_std Rust library for Type-Driven Security (XSS and injection prevention).
Documentation
1
2
3
4
5
6
7
8
9
10
11
import re

with open('src/lib.rs', 'r') as f:
    content = f.read()

content = re.sub(r'&bytes\[([^\]]+)\]', r'bytes.get(\1).unwrap_or(&[])', content)
content = re.sub(r'bytes\[idx\]', r'*bytes.get(idx).unwrap_or(&0)', content)
content = re.sub(r'&text\[([^\]]+)\]', r'text.get(\1).unwrap_or("")', content)

with open('src/lib.rs', 'w') as f:
    f.write(content)