Rust library for safely and explicitly handling untrusted aka dangerous
data
Documentation hosted on docs.rs.
toml
dangerous = "0.1"
no-std
/ suitable for embedded.[1] Allocations for error cases (alloc
feature is recommended for better
perf).
[2] Zero-dependencies if the unicode
feature is disabled.
This library's intentions are to provide a simple interface for explicitly parsing untrusted data safely. It tries to achieve this by providing useful primitives for parsing data and an optional, but solid, debugging interface with sane input formatting and errors to weed out problems before, or after they arise in production.
Passing down errors as simple as core::str::Utf8Error
may be useful enough to
debug while in development, however when just written into logs without the
input/context, often amount to noise. At this stage you are almost better off
with a simple input error.
Ever tried working backwards from something like this?
Wouldn't it be better if this was the alternative?
```
['h' 'e' ff 'l' 'o'] ^^ additional: error offset: 2, input length: 5 backtrace: 1.
read all
2.read
(expected message) 3.read
(expected body) 4.convert input to str
(expected utf-8 code point) ```
This library has a instance of unsafe
required for wrapping a byte slice into
the Input
DST and multiple instances required for str::from_utf8_unchecked
used in display section.
This project was originally inspired by untrusted.