Skip to main content

Module builder

Module builder 

Source
Expand description

Builder pattern API for constructing inventories.

Provides a fluent, closure-based API for building an Inventory without manually constructing every nested struct.

§Example

use stationxml_rs::Inventory;

let inv = Inventory::builder()
    .source("Pena Bumi")
    .network("XX", |net| {
        net.description("Local Test Network")
           .station("PBUMI", |sta| {
               sta.latitude(-7.7714)
                  .longitude(110.3776)
                  .elevation(150.0)
                  .site_name("Yogyakarta")
                  .channel("SHZ", "00", |ch| {
                      ch.azimuth(0.0).dip(-90.0).sample_rate(100.0)
                  })
           })
    })
    .build();

assert_eq!(inv.networks[0].stations[0].channels[0].code, "SHZ");

Structs§

ChannelBuilder
Builder for Channel.
InventoryBuilder
Builder for Inventory.
NetworkBuilder
Builder for Network.
StationBuilder
Builder for Station.