gluex-rcdb

Crates.iogluex-rcdb
lib.rsgluex-rcdb
version0.1.5
created_at2025-12-14 22:10:32.833733+00
updated_at2026-01-22 18:32:56.164959+00
descriptionA Rust interface to the GlueX Run Condition Database (RCDB)
homepagehttps://github.com/denehoffman/gluex-rs
repositoryhttps://github.com/denehoffman/gluex-rs
max_upload_size
id1985184
size98,680
Nathaniel D. Hoffman (denehoffman)

documentation

https://docs.rs/gluex-rcdb

README

gluex-rcdb

Rust bindings for the GlueX Run Condition Database (RCDB). This crate provides a simple interface for loading run conditions from RCDB which match the given context (run numbers and filters). It also provides common aliases used to determine production data.

Installation

cargo add gluex-rcdb

Example

use gluex_core::run_periods::RunPeriod;
use gluex_rcdb::{
    conditions,
    prelude::{Context, RCDB},
};

fn main() -> gluex_rcdb::RCDBResult<()> {
    let rcdb = RCDB::open("/path/to/rcdb.sqlite")?;
    let filters = conditions::aliases::approved_production(RunPeriod::RP2018_08);
    let ctx = Context::default().with_run_range(55_000..=55_050).filter(filters);
    let rows = rcdb.fetch(["polarization_angle", "polarization_direction"], &ctx)?;

    for (run, values) in rows {
        if let Some(angle) = values
            .get("polarization_angle")
            .and_then(|v| v.as_float())
        {
            println!("run {run}: angle = {angle:.2}");
        }
    }
    Ok(())
}

License

Dual-licensed under Apache-2.0 or MIT.

Commit count: 77

cargo fmt