#untrusted #input #primitive #parser

no-std untrustended

Untrustended - Untrusted Extended. A compilation of primitives for parsing values from untrusted input.

12 releases

Uses new Rust 2024

0.4.5 Feb 20, 2026
0.4.4 Sep 22, 2025
0.4.3 Jun 18, 2025
0.4.2 Jan 13, 2025
0.0.2 Jul 23, 2017

#9 in #untrusted

Download history 173/week @ 2025-11-13 398/week @ 2025-11-20 368/week @ 2025-11-27 423/week @ 2025-12-04 232/week @ 2025-12-11 107/week @ 2025-12-18 1/week @ 2025-12-25 40/week @ 2026-01-01 252/week @ 2026-01-08 207/week @ 2026-01-15 425/week @ 2026-01-22 367/week @ 2026-01-29 286/week @ 2026-02-05 418/week @ 2026-02-12 285/week @ 2026-02-19 515/week @ 2026-02-26

1,584 downloads per month
Used in pktbuilder

ISC license

29KB
399 lines

Untrustended - Untrusted Extended.

Untrustended is a compilation of primitives for parsing values from untrusted input. It's building on top of untrusted's Reader::read_byte() and Reader::read_bytes().

Please, consult untrusted's documentation about how to use that crate before attempting to use this one.

To use the new methods provided by this crate:

use untrustended::ReaderExt;

then construct a Reader as usual and enjoy.

Example:

use untrusted::{Input, Reader};
use untrustended::{ReaderExt, Error};

fn read_stuff(input: &mut Reader<'_>) -> Result<(u8, u16, u32), Error> {
    let one_byte = input.read_u8()?;
    let big_endian_u16 = input.read_u16be()?;
    let little_endian_u32 = input.read_u32le()?;
    Ok((one_byte, big_endian_u16, little_endian_u32))
}

fn main() {
    let buf = vec![0, 1, 2, 3, 4, 5, 6];
    let input = Input::from(&buf);

    input.read_all(Error::UnknownError, read_stuff).expect("read_all to succeed");
}

untrustended Crates.io

Untrustended is a compilation of primitives for parsing values from untrusted input. It's building on top of untrusted's Reader::read_byte().

Please, consult untrusted's documentation about how to use that crate before attempting to use this one.

Example

See usage example in untrustended documentation.

License

See LICENSE.txt. ISC license.

Dependencies

~28KB