7 releases

0.2.4 Jan 6, 2024
0.2.3 Jan 5, 2024
0.2.2 Nov 7, 2023
0.2.1 Sep 3, 2023
0.1.2 Jun 16, 2023

#7 in #tlv

Download history 1537/week @ 2024-11-17 844/week @ 2024-11-24 767/week @ 2024-12-01 318/week @ 2024-12-08 1306/week @ 2024-12-15 92/week @ 2024-12-22 351/week @ 2024-12-29 1369/week @ 2025-01-05 1535/week @ 2025-01-12 1030/week @ 2025-01-19 999/week @ 2025-01-26 1161/week @ 2025-02-02 524/week @ 2025-02-09 573/week @ 2025-02-16 405/week @ 2025-02-23 666/week @ 2025-03-02

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

MIT/Apache

15KB
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

~0.9–1.4MB
~29K SLoC