Expand description
Safely and explicitly parse untrusted aka dangerous data.
§Basic usage
use dangerous::{Input, Invalid};
let input = dangerous::input(b"hello");
let result: Result<_, Invalid> = input.read_partial(|r| {
r.read_u8()
});
assert_eq!(result, Ok((b'h', dangerous::input(b"ello"))));§Feature flags
| Feature | Default | Description |
|---|---|---|
std | Enabled | Enables std::error::Error support and alloc |
alloc | Enabled | Enables allocations. |
simd | Enabled | Enables all supported SIMD optimisations. |
unicode | Enabled | Enables improved unicode printing support. |
full-backtrace | Enabled | Enables collection of all contexts for Expected. |
zc | Disabled | Enables zc crate support. |
nom | Disabled | Enables nom crate error support. |
regex | Disabled | Enables regex pattern support. |
Re-exports§
pub use self::error::Error;pub use self::error::Expected;pub use self::error::Fatal;pub use self::error::Invalid;pub use self::error::ToRetryRequirement;
Modules§
Structs§
- Bytes
- Raw
Input. - Peek
- Peek of
Input. - Reader
- Created from and consumes an
Input. - Span
- Range of
Input. - String
- UTF-8
Input.
Enums§
- Bound
- Indication of whether
Inputwill change in futher passes. - Maybe
String Stringif known UTF-8,Bytesif not.
Traits§
- Input
- Implemented for immutable wrappers around bytes to be processed (
Bytes/String). - Pattern
- Implemented for structures that can be found within an
Input.
Functions§
- input
- Creates a new
Inputfrom a byte or string slice.
Type Aliases§
- Bytes
Reader BytesspecificReader.- String
Reader StringspecificReader.