L3 Order Book

Deep nested / ragged L3 order-book sample for ergo-sbe. publish = false.

Conversion style: with_domain_type only

#![allow(unused)]
fn main() {
    use ergo_sbe::{ConversionSelector, GenerationConfig};
    // B — concrete mapping: one Rust type per wire type (already enables conversion)
    let _cfg = GenerationConfig::new("msgs").with_domain_type(
        ConversionSelector::named_type("Decimal"),
        "rust_decimal::Decimal",
    );
}

(From book/examples/conversion-config.rs. Full L3 build.rs: l3-book.)

Generated API (concrete):

enc.try_price(rust_decimal::Decimal::new(100, 0))?;
let p: rust_decimal::Decimal = dec.try_price()?;
let ts: DateTime<Utc> = dec.try_exchange_timestamp()?;

with_domain_type already enables conversion for that selector. Do not also call with_conversion(Decimal) here — it would not change the surface.

NeedUse
Concrete price() -> DecimalThis sample (with_domain_type)
Generic price_as::<T>() / app adaptersExchange Example (with_conversion)
Side-by-side both stylesSBE Feature Tour

Layout

PathRole
schemas/l3-book.xmlNested bids/asks, orders, var-data tails
build.rsgenerate_to_dir into src/generated/ + domain objects / with_domain_type (build-dep only)
src/lib.rs#[path = "generated/l3_codec.rs"] + EncodedLength helpers
src/main.rsRunnable demos
tests/l3_tests.rsRound-trips

Run

cargo run  --manifest-path samples/l3-book/Cargo.toml
cargo test --manifest-path samples/l3-book/Cargo.toml