Value and view types

This library contains two types to represent bencoded data, the value type bvalue and the view type bview.

bvalue owns the data it contains. Parsing to bvalue involves copying data to the internal storage of a bvalue. bvalue can modify the stored values.

bview does not own any data. Parsing to bview is done by creating an index of type descriptor_table into a stable buffer with bencoded data. Based on this index bview provides read-only access to the bencoded data.

The interfaces of bvalue and bview are very similar. This enable the use of both types in a generic code.

Performance

Parsing to bview is about 5 times faster then parsing to bvalue.

../_images/decoding_value_vs_view.svg

Contents

Value interface View interface