8 releases

0.3.0 Jun 10, 2025
0.2.4 Jan 6, 2024
0.2.2 Nov 7, 2023
0.2.1 Sep 3, 2023
0.1.2 Jun 16, 2023

#25 in #allocation

Download history 874/week @ 2025-07-26 853/week @ 2025-08-02 760/week @ 2025-08-09 733/week @ 2025-08-16 794/week @ 2025-08-23 1417/week @ 2025-08-30 1244/week @ 2025-09-06 838/week @ 2025-09-13 339/week @ 2025-09-20 349/week @ 2025-09-27 410/week @ 2025-10-04 401/week @ 2025-10-11 391/week @ 2025-10-18 488/week @ 2025-10-25 464/week @ 2025-11-01 1379/week @ 2025-11-08

2,786 downloads per month
Used in 3 crates (2 directly)

MIT/Apache

14KB
195 lines

tlv-rs

A minimal parser for SIMPLE TLVs.

no_std

This crate requires allocations, because of the Cow type.

Performance

On my 12th Gen Intel 1240p Framework laptop the following speeds were achieved.

-- ns/iter
read_tlv 1.37
write_tlv 2.98

A note on throughput

Since the implementation only parses the header and stores the body, as a slice, all read operations are $O(1)$ and all writes $O(n)$.

Panics

In the no_panic example all functions, except for to_bytes_dynamic since it allocates and can therefore panic, are proven to never panic.

Dependencies

~1–1.4MB
~28K SLoC