bgpkit_parser/render/mod.rs
1/*!
2Human-readable record rendering.
3
4The [`text`] module renders one [`MrtRecord`](crate::MrtRecord) as a layered, indented text
5block — a full-fidelity transcript of the record: BGP4MP session context,
6withdrawn and announced prefixes, every path attribute, and RFC 7606
7validation warnings. The format is designed around this crate's own models
8(reusing the leaf `Display` implementations), not around any external tool's
9output; it is *inspired by bgpdump's human-readable output*.
10
11The crate-private `psv` writer renders one [`BgpElem`](crate::BgpElem) as a single PSV row,
12appending every field to a caller-supplied buffer so a streaming caller reuses one allocation.
13
14The [`hex`] module encodes raw record bytes (as yielded by
15[`BgpkitParser::into_filtered_raw_record_iter`](crate::BgpkitParser::into_filtered_raw_record_iter))
16as single hex strings — the paste format for byte-level dissectors such as
17[wirescope](https://wirescope.labs.bgpkit.com).
18
19Rendering is a pure function of the record: no iterators, no I/O, no
20session state. RIB entries reference peers by their table index because the
21peer table lives in a separate, earlier record.
22
23# Example
24
25```
26use bgpkit_parser::render::text::format_record;
27use bgpkit_parser::BgpkitParser;
28
29let parser = BgpkitParser::new("tests/fixtures/ripe/rrc00/2000.01/updates.20000102.2014.gz").unwrap();
30for record in parser.into_record_iter() {
31 println!("{}", format_record(&record));
32}
33```
34*/
35
36pub mod hex;
37pub(crate) mod psv;
38pub mod text;