brk_traversable

Crates.iobrk_traversable
lib.rsbrk_traversable
version0.1.0-beta.0
created_at2025-12-18 22:16:48.435568+00
updated_at2026-01-25 13:22:04.463666+00
descriptionTraits for Vecs structs throughout BRK
homepagehttps://bitcoinresearchkit.org
repositoryhttps://github.com/bitcoinresearchkit/brk
max_upload_size
id1993657
size35,167
(nym21)

documentation

README

brk_traversable

Trait for navigating and exporting hierarchical data structures.

What It Enables

Traverse nested data collections (datasets, grouped metrics) as trees for inspection, and iterate all exportable vectors for bulk data export.

Key Features

  • Tree navigation: Convert nested structs into TreeNode hierarchies for exploration
  • Export iteration: Walk all AnyExportableVec instances in a data structure
  • Derive macro: #[derive(Traversable)] with derive feature
  • Compression backends: Support for PCO, LZ4, ZeroCopy, Zstd via feature flags
  • Blanket implementations: Works with Box<T>, Option<T>, BTreeMap<K, V>

Core API

pub trait Traversable {
    fn to_tree_node(&self) -> TreeNode;
    fn iter_any_exportable(&self) -> impl Iterator<Item = &dyn AnyExportableVec>;
}

Supported Vec Types

All vecdb vector types implement Traversable:

  • BytesVec, EagerVec, PcoVec (with pco feature)
  • ZeroCopyVec (with zerocopy feature)
  • LZ4Vec, ZstdVec (with respective features)
  • LazyVecFrom1/2/3 for derived vectors

Feature Flags

  • derive - Enable #[derive(Traversable)] macro
  • pco - PCO compression support
  • zerocopy - Zero-copy vector support
  • lz4 - LZ4 compression support
  • zstd - Zstd compression support

Built On

  • brk_types for TreeNode type
  • brk_traversable_derive for the derive macro (optional)
Commit count: 1045

cargo fmt